Class NullImplementation.NullCacheStore
- All Implemented Interfaces:
CacheLoader
,CacheStore
- Enclosing class:
NullImplementation
-
Field Summary
Modifier and TypeFieldDescriptionstatic final NullImplementation.NullCacheStore
Singleton instance. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Remove the specified key from the underlying store if present.void
eraseAll
(Collection colKeys) Remove the specified keys from the underlying store if present.Return the value associated with the specified key, or null if the key does not have an associated value in the underlying store.loadAll
(Collection colKeys) Return the values associated with each the specified keys in the passed collection.void
Store the specified value under the specified key in the underlying store.void
Store the specified values under the specified keys in the underlying store.
-
Field Details
-
INSTANCE
Singleton instance.
-
-
Constructor Details
-
NullCacheStore
public NullCacheStore()
-
-
Method Details
-
load
Return the value associated with the specified key, or null if the key does not have an associated value in the underlying store.- Specified by:
load
in interfaceCacheLoader
- Parameters:
oKey
- key whose associated value is to be returned- Returns:
- the value associated with the specified key, or null if no value is available for that key
-
loadAll
Return the values associated with each the specified keys in the passed collection. If a key does not have an associated value in the underlying store, then the return map will not have an entry for that key.The default implementation of this method calls
CacheLoader.load(K)
for each key in the supplied Collection. Implementations that can optimize multi-key operationsshould
override this default implementation.- Specified by:
loadAll
in interfaceCacheLoader
- Parameters:
colKeys
- a collection of keys to load- Returns:
- a Map of keys to associated values for the specified keys
-
store
Store the specified value under the specified key in the underlying store. This method is intended to support both key/value creation and value update for a specific key.- Specified by:
store
in interfaceCacheStore
- Parameters:
oKey
- key to store the value underoValue
- value to be stored
-
storeAll
Store the specified values under the specified keys in the underlying store. This method is intended to support both key/value creation and value update for the specified keys.If this operation fails (by throwing an exception) after a partial success, the convention is that entries which have been stored successfully are to be removed from the specified mapEntries, indicating that the store operation for the entries left in the map has failed or has not been attempted.
The default implementation of this method calls
CacheStore.store(K, V)
for each entry in the supplied Map. Once stored successfully, an entry is removed from the Map (if possible). Implementations that can optimize multi-entry operationsshould
override this default implementation.- Specified by:
storeAll
in interfaceCacheStore
- Parameters:
mapEntries
- a Map of any number of keys and values to store
-
erase
Remove the specified key from the underlying store if present.- Specified by:
erase
in interfaceCacheStore
- Parameters:
oKey
- key whose mapping is being removed from the cache
-
eraseAll
Remove the specified keys from the underlying store if present.If this operation fails (by throwing an exception) after a partial success, the convention is that keys which have been erased successfully are to be removed from the specified colKeys, indicating that the erase operation for the keys left in the collection has failed or has not been attempted.
The default implementation of this method calls
CacheStore.erase(K)
for each key in the supplied Collection. Once erased successfully, the key is removed from the Collection (if possible). Implementations that can optimize multi-key operationsshould
override this default implementation.- Specified by:
eraseAll
in interfaceCacheStore
- Parameters:
colKeys
- keys whose mappings are being removed from the cache
-