Class ClientCache<K,V>
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)
. ClientCacheEntry
s 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 Summary
-
Method Summary
-
Constructor Details
-
ClientCache
public ClientCache()Default constructor.
-
-
Method Details
-
put
Add an element to the client cache.- Parameters:
entry
- the entry to add.
-
remove
Remove an entry from the client cache.- Parameters:
key
- the key to remove.
-
get
Retrieve an entry from the client cache.- Parameters:
key
- the key to the entry to retrieve.- Returns:
- the entry or null.
-