|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.commons.cache.BaseCache
public abstract class BaseCache
An abstract base Cache implementation,
managing the registration of listeners and the
broadcast of events.
| Field Summary | |
|---|---|
protected ArrayList |
_retrievalListeners
My list of RetrievalListeners. |
protected ArrayList |
_storageListeners
My list of StorageListeners. |
| Constructor Summary | |
|---|---|
BaseCache()
|
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected ArrayList _storageListeners
StorageListeners.
protected ArrayList _retrievalListeners
RetrievalListeners.
| Constructor Detail |
|---|
public BaseCache()
| Method Detail |
|---|
public abstract boolean store(Serializable key,
Serializable val,
Long expiry,
Long cost,
Serializable group)
Cache
store in interface Cachekey - the key used to later obtain the val from me,
which MUST NOT be null.val - the val to store, which MUST NOT be null.expiry - the timestamp at which the given val becomes stale, or null.cost - the implemenation dependent cost of generating the val, or null.group - a meta-key which can be used to clear the object later
public abstract Serializable retrieve(Serializable key)
Cachestored under
the given key.
retrieve in interface Cachekey - the key which MUST NOT be null.
stored value, or null.public abstract Serializable[] getKeysForGroup(Serializable group)
getKeysForGroup in interface Cachepublic abstract boolean contains(Serializable key)
Cache
contains in interface Cachekey - the key which MUST NOT be null.
public abstract void clear(Serializable key)
Cachestored under
the given key.
clear in interface Cachekey - the key which MUST NOT be null.public abstract void clear()
Cachestored.
clear in interface Cache
public long getStat(CacheStat stat)
throws UnsupportedOperationException
getStat in interface CacheUnsupportedOperationExceptionpublic void clearGroup(Serializable group)
Cachestored under
the given group.
clearGroup in interface Cachegroup - the group which MUST NOT be null.
public boolean store(Serializable key,
Serializable val,
Long expiry,
Long cost)
Cache
store in interface Cachekey - the key used to later obtain the val from me,
which MUST NOT be null.val - the val to store, which MUST NOT be null.expiry - the timestamp at which the given val becomes stale, or null.cost - the implemenation dependent cost of generating the val, or null.
public void registerStorageListener(StorageListener obs)
StorageListener to my
set of StorageListeners.
registerStorageListener in interface Cachepublic void unregisterStorageListener(StorageListener obs)
StorageListener from my
set of StorageListeners.
unregisterStorageListener in interface Cachepublic void unregisterStorageListeners()
StorageListeners.
unregisterStorageListeners in interface Cachepublic void registerRetrievalListener(RetrievalListener obs)
RetrievalListener to my
set of RetrievalListeners.
registerRetrievalListener in interface Cachepublic void unregisterRetrievalListener(RetrievalListener obs)
RetrievalListener from my
set of RetrievalListeners.
unregisterRetrievalListener in interface Cachepublic void unregisterRetrievalListeners()
RetrievalListeners.
unregisterRetrievalListeners in interface Cache
protected void broadcastStoreRequested(Serializable key,
Serializable val,
Long expiresAt,
Long cost,
Serializable group)
StorageListener.storeRequested(java.io.Serializable,java.io.Serializable,java.lang.Long,java.lang.Long,java.io.Serializable)
event to my set of StorageListeners.
key - the cache keyval - the cache valueexpiresAt - the expiration timestamp, or nullcost - the cost of the object, or null
protected void broadcastStored(Serializable key,
Serializable val,
Long expiresAt,
Long cost,
Serializable group)
StorageListener.stored(java.io.Serializable,java.io.Serializable,java.lang.Long,java.lang.Long,java.io.Serializable)
event to my set of StorageListeners.
key - the cache keyval - the cache valueexpiresAt - the expiration timestamp, or nullcost - the cost of the object, or null
protected void broadcastNotStored(Serializable key,
Serializable val,
Long expiresAt,
Long cost,
Serializable group)
StorageListener.notStored(java.io.Serializable,java.io.Serializable,java.lang.Long,java.lang.Long,java.io.Serializable)
event to my set of StorageListeners.
key - the cache keyval - the cache valueexpiresAt - the expiration timestamp, or nullcost - the cost of the object, or nullprotected void broadcastCleared(Serializable key)
StorageListener.cleared(java.io.Serializable)
event to my set of StorageListeners.
key - the cache keyprotected void broadcastCleared()
StorageListener.cleared()
event to my set of StorageListeners.
protected void broadcastRetrieveRequested(Serializable key)
RetrievalListener.retrieveRequested(java.io.Serializable)
event to my set of RetrievalListeners.
key - the cache keyprotected void broadcastRetrieved(Serializable key)
RetrievalListener.retrieved(java.io.Serializable)
event to my set of RetrievalListeners.
key - the cache keyprotected void broadcastNotRetrieved(Serializable key)
RetrievalListener.notRetrieved(java.io.Serializable)
event to my set of RetrievalListeners.
key - the cache key
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||