|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.wamblee.cache.CachedObject<KeyType,ValueType>
public class CachedObject<KeyType extends java.io.Serializable,ValueType extends java.io.Serializable>
Represents a cached object. The object is either retrieved from the cache if the cache has it, or a call back is invoked to get the object (and put it in the cache).
| Nested Class Summary | |
|---|---|
static interface |
CachedObject.Computation<Key extends java.io.Serializable,Value extends java.io.Serializable>
Callback invoked to compute an object if it was not found in the cache. |
| Constructor Summary | |
|---|---|
CachedObject(Cache<KeyType,ValueType> aCache,
KeyType aObjectKey,
CachedObject.Computation<KeyType,ValueType> aComputation)
Constructs the cached object. |
|
| Method Summary | |
|---|---|
ValueType |
get()
Gets the object. |
Cache |
getCache()
Gets the cache. |
void |
invalidate()
Invalidates the cache for the object so that it is recomputed the next time it is requested. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public CachedObject(Cache<KeyType,ValueType> aCache,
KeyType aObjectKey,
CachedObject.Computation<KeyType,ValueType> aComputation)
aCache - Cache to use.aObjectKey - Key of the object in the cache.aComputation - Computation to get the object in case the object is not in the
cache.| Method Detail |
|---|
public ValueType get()
public void invalidate()
public Cache getCache()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||