public abstract class ClientCache<K,V>
extends java.lang.Object
The ClientCache stores ClientCacheEntry's to speed up read operations.
When an object is stored in the ScaleOut Cache and the ClientCacheOptions.DeepCopy or ClientCacheOptions.Reference are specified,
that object is placed into a in-process ClientCache. When reading the object, a lightweight version check will
determine if the object can be retrieved from the ClientCache avoiding the receiving of the object from the
ScaleOut in-memory data grid and subsequent deserialization of the object.
The implementation of the ClientCache is a weighted, thread-safe HashMap. The weighted size of the ClientCache
is defined by the CacheBuilder.clientCacheSize(int). ClientCacheEntrys are evicted when the total entry
weight (the summation of all ClientCacheEntryWeigher.evaluateEntryWeight(ClientCacheEntry)) is greater-than the
value of the client cache weighted size.
By default, the ClientCache uses the default ClientCacheEntryWeigher which weighs a ClientCacheEntry
based on the length of the serialized V object.
The CacheBuilder.clientCacheEntryWeigher(ClientCacheEntryWeigher) and CacheBuilder.clientCacheSize(int)
can be used to customize per-entry weights and eviction.
| Constructor and Description |
|---|
ClientCache()
Default constructor.
|
| Modifier and Type | Method and Description |
|---|---|
abstract ClientCacheEntry<K,V> |
get(K key)
Retrieve an entry from the client cache.
|
abstract void |
put(ClientCacheEntry<K,V> entry)
Add an element to the client cache.
|
abstract void |
remove(K key)
Remove an entry from the client cache.
|
public abstract void put(ClientCacheEntry<K,V> entry)
entry - the entry to add.public abstract void remove(K key)
key - the key to remove.public abstract ClientCacheEntry<K,V> get(K key)
key - the key to the entry to retrieve.