|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.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 RetrievalListener s. |
protected ArrayList |
_storageListeners
My list of StorageListener s. |
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
StorageListener
s.
protected ArrayList _retrievalListeners
RetrievalListener
s.
Constructor Detail |
---|
public BaseCache()
Method Detail |
---|
public abstract boolean store(Serializable key, Serializable val, Long expiry, Long cost, Serializable group)
Cache
store
in interface Cache
key
- 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)
Cache
stored
under
the given key.
retrieve
in interface Cache
key
- the key which MUST NOT be null.
stored
value, or null.public abstract Serializable[] getKeysForGroup(Serializable group)
getKeysForGroup
in interface Cache
public abstract boolean contains(Serializable key)
Cache
contains
in interface Cache
key
- the key which MUST NOT be null.
public abstract void clear(Serializable key)
Cache
stored
under
the given key.
clear
in interface Cache
key
- the key which MUST NOT be null.public abstract void clear()
Cache
stored
.
clear
in interface Cache
public long getStat(CacheStat stat) throws UnsupportedOperationException
getStat
in interface Cache
UnsupportedOperationException
public void clearGroup(Serializable group)
Cache
stored
under
the given group.
clearGroup
in interface Cache
group
- the group which MUST NOT be null.public boolean store(Serializable key, Serializable val, Long expiry, Long cost)
Cache
store
in interface Cache
key
- 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 StorageListener
s.
registerStorageListener
in interface Cache
public void unregisterStorageListener(StorageListener obs)
StorageListener
from my
set of StorageListener
s.
unregisterStorageListener
in interface Cache
public void unregisterStorageListeners()
StorageListener
s.
unregisterStorageListeners
in interface Cache
public void registerRetrievalListener(RetrievalListener obs)
RetrievalListener
to my
set of RetrievalListener
s.
registerRetrievalListener
in interface Cache
public void unregisterRetrievalListener(RetrievalListener obs)
RetrievalListener
from my
set of RetrievalListener
s.
unregisterRetrievalListener
in interface Cache
public void unregisterRetrievalListeners()
RetrievalListener
s.
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 StorageListener
s.
key
- the cache keyval
- the cache valueexpiresAt
- the expiration timestamp, or nullcost
- the cost of the object, or nullprotected 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 StorageListener
s.
key
- the cache keyval
- the cache valueexpiresAt
- the expiration timestamp, or nullcost
- the cost of the object, or nullprotected 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 StorageListener
s.
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 StorageListener
s.
key
- the cache keyprotected void broadcastCleared()
StorageListener.cleared()
event to my set of StorageListener
s.
protected void broadcastRetrieveRequested(Serializable key)
RetrievalListener.retrieveRequested(java.io.Serializable)
event to my set of RetrievalListener
s.
key
- the cache keyprotected void broadcastRetrieved(Serializable key)
RetrievalListener.retrieved(java.io.Serializable)
event to my set of RetrievalListener
s.
key
- the cache keyprotected void broadcastNotRetrieved(Serializable key)
RetrievalListener.notRetrieved(java.io.Serializable)
event to my set of RetrievalListener
s.
key
- the cache key
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |