|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.sandev.basics.util.IDCacheBase
Provides common methods for all IDCache implementations. This class provides utilities and a framework for cache implementation using a Map, override the init method to change what kind of map is used.
| Field Summary | |
protected java.util.Map |
map
The caching data structure. |
protected boolean |
revisionCheck
If true, then only newer revisions of a message will be accepted by put. |
| Constructor Summary | |
IDCacheBase()
Default ctor calls init |
|
| Method Summary | |
boolean |
checkRevisionNumber()
accessor for revisionCheck |
void |
clear()
Remove all entries from this cache. |
SandPersistMessage |
getInstance(long id)
Given a persistent ID, return the associated message instance. |
java.util.Map |
getMap()
Return the underlying map used by the cache. |
static java.lang.Object |
idToKey(long id)
We need an object to use as a key. |
void |
init()
Initialize the Map to a synchronized HashMap. |
boolean |
putInstance(SandPersistMessage msg)
Given a persistent messsage, store it in the cache. |
SandPersistMessage |
removeInstance(long id)
Given a persistent ID, remove it from the cache. |
void |
setRevisionCheck(boolean val)
mutator for revisionCheck |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
protected java.util.Map map
protected boolean revisionCheck
| Constructor Detail |
public IDCacheBase()
| Method Detail |
public boolean checkRevisionNumber()
public void setRevisionCheck(boolean val)
public boolean putInstance(SandPersistMessage msg)
IDCache
putInstance in interface IDCachepublic SandPersistMessage getInstance(long id)
IDCache
getInstance in interface IDCachepublic SandPersistMessage removeInstance(long id)
IDCache
removeInstance in interface IDCachepublic void clear()
IDCache
clear in interface IDCachepublic java.util.Map getMap()
IDCacheIDCache.putInstance(org.sandev.basics.structs.SandPersistMessage)
and IDCache.removeInstance(long) methods should be used for cache manipulation,
and this method should only be used for read-only access like iteration
over the map's contents.
If the IDCache is not backed by a map, returns null.
getMap in interface IDCachepublic static java.lang.Object idToKey(long id)
public void init()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||