public class CachedObject<KeyType extends Serializable,ValueType extends Serializable> extends Object
Cache. 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).| Modifier and Type | Class and Description | 
|---|---|
| static interface  | CachedObject.Computation<Key extends Serializable,Value extends Serializable>Callback invoked to compute an object if it was not found in the cache. | 
| Constructor and Description | 
|---|
| CachedObject(Cache<KeyType,ValueType> aCache,
            KeyType aObjectKey,
            CachedObject.Computation<KeyType,ValueType> aComputation)Constructs the cached object. | 
| Modifier and Type | Method and Description | 
|---|---|
| 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. | 
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.public ValueType get()
public void invalidate()
public Cache getCache()
Copyright © 2025. All rights reserved.