K - the key type parameterV - the value type parameterC - the context type parameterpublic abstract class FutureWebNotifCache<K,V,C> extends Object
A future cache that prevents the loading of the same resource twice. This should be used when the resource to load is very expensive or cannot be concurrently retrieved (like a classloading).
The future cache should be used with the #get(Object, Object) method, that retrieves an object
from the cache and check it contains these elements in within offset and limit.
When the sublist is not found or size less than the limit, then the Loader.retrieve(Object, Object) method
is used to retrieve the data and then this data is inserted in the cache.
The class is abstract and does not implement a cache technology by itself, the cache implementation is delegated
to the contractual methods #get(Object) and put(Object, Object). Those methods are intended
to be used by the future cache only.
The Loader interface provides a source to retrieve objects to put in the cache. The goal to maintain
this interface is to decouple the cache from the object source.
| Constructor and Description |
|---|
FutureWebNotifCache(org.exoplatform.commons.cache.future.Loader<K,V,C> loader) |
| Modifier and Type | Method and Description |
|---|---|
V |
get(C context,
K key,
long offset,
long limit)
Perform a cache lookup for the specified key within the specified context.
|
protected abstract V |
get(K key,
long offset,
long limit)
Retrieves the cached value corresponding to the specified key from the cache, it must returns null when the
key does not exist.
|
protected abstract void |
put(K key,
V value)
Updates the cache with a new key/value pair.
|
protected abstract V get(K key, long offset, long limit)
key - the keyprotected abstract void put(K key, V value)
key - the keyvalue - the cache valuepublic final V get(C context, K key, long offset, long limit)
context - the context in which the resource is accessedkey - the key identifying the resourceoffset - the offset of the listlimit - the limit of the listCopyright © 2003–2016 eXo Platform SAS. All rights reserved.