|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
V
- public interface ObjectIdentityCache<K,V>
An object cache for create-once-by-name-and-then-reuse objects. Objects are added, but never removed. Subsequent get()s using the same key will return the exact same object, UNLESS all such objects have been forgotten, in which case a new object MAY be returned. This allows implementors (such as ObjectIdentityBdbCache or CachedBdbMap) to page out (aka 'expunge') instances to persistent storage while they're not being used. However, as long as they are used (referenced), all requests for the same-named object will share a reference to the same object, and the object may be mutated in place without concern for explicitly persisting its state to disk.
Method Summary | |
---|---|
void |
close()
close/release any associated resources |
V |
get(K key)
get the object under the given key/name |
V |
getOrUse(K key,
Supplier<V> supplierOrNull)
get the object under the given key/name, using (and remembering) the object supplied by the supplier if no prior mapping exists |
java.util.Set<K> |
keySet()
set of all keys |
int |
size()
count of name-to-object contained |
void |
sync()
force the persistent backend, if any, to be updated with all live object state |
Method Detail |
---|
V get(K key)
V getOrUse(K key, Supplier<V> supplierOrNull)
void sync()
void close()
close
in interface java.io.Closeable
int size()
java.util.Set<K> keySet()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |