|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
A generic cache system. A client can use this to cache data that was hard to calculate. The data is not converted in any way so it is the responsability of the client to correct platform depending issues like endianess and structure padding. Every item in a cache has a 'type', a 'scope', and a unique id. The 'type' can be something like 'lightmap', 'octree', ... The 'scope' can be something like 'myRegion_mySector', ... The 'id' is a unique ID for the cached item in the given type and scope. ~0 can be taken for the cases "no ID" or "ID unused". Avoid using '/' and '\' characters in both type and scope as this may cause conflicts with the given cache (if it caches on a file system for example). Note that both 'type' and 'scope' can be made default using SetCurrentType() and SetCurrentScope(). If those are set then you can use 0 for type and/or scope in CacheData() and ReadCache(). If you don't use 0 then the given value will override the default values.
Method Summary | |
boolean |
cacheData(iPointer data,
int size,
java.lang.String type,
java.lang.String scope,
int id)
Cache some data. |
boolean |
clearCache()
Clear items from the cache. |
boolean |
clearCache(java.lang.String type)
Clear items from the cache. |
boolean |
clearCache(java.lang.String type,
java.lang.String scope)
Clear items from the cache. |
boolean |
clearCache(java.lang.String type,
java.lang.String scope,
int id)
Clear items from the cache. |
java.lang.String |
getCurrentScope()
Get current scope or 0 if none set. |
java.lang.String |
getCurrentType()
Get current type or 0 if none set. |
iDataBuffer |
readCache(java.lang.String type,
java.lang.String scope,
int id)
Retrieve some data from the cache. |
void |
setCurrentScope(java.lang.String scope)
Set current scope. |
void |
setCurrentType(java.lang.String type)
Set current type. |
Methods inherited from interface crystalspace.jbind.interfaces.iutil.scf.iBase |
decRef, getName, getRefCount, getVersion, incRef, queryInterface, queryInterfaceSafe |
Methods inherited from interface crystalspace.jbind.interfaces.iPointer |
changePointer, getPointer, isMemoryOwner, setMemoryOwner |
Method Detail |
public boolean cacheData(iPointer data, int size, java.lang.String type, java.lang.String scope, int id)
data
- size
- type
- scope
- id
-
public boolean clearCache()
public boolean clearCache(java.lang.String type)
type
-
public boolean clearCache(java.lang.String type, java.lang.String scope)
type
- scope
-
public boolean clearCache(java.lang.String type, java.lang.String scope, int id)
type
- scope
- id
-
public java.lang.String getCurrentScope()
public java.lang.String getCurrentType()
public iDataBuffer readCache(java.lang.String type, java.lang.String scope, int id)
type
- scope
- id
-
public void setCurrentScope(java.lang.String scope)
scope
- public void setCurrentType(java.lang.String type)
type
-
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |