public interface SmartCache<K,V>
To iterate over the contents of a cache, you must pass a
execute(SmartCacheTask)
instance. The code using the iterator
can be assured that it will be thread safe.
Implementations are responsible of enforcing thread safety.
Modifier and Type | Interface and Description |
---|---|
static interface |
SmartCache.SmartCacheTask<K,V>
Defines a task to be run over the entries of the cache.
|
Modifier and Type | Method and Description |
---|---|
void |
clear()
Clears the contents of this cache.
|
void |
execute(SmartCache.SmartCacheTask<K,V> task)
Executes a task over the contents of the cache and guarantees
exclusive write access while processing.
|
V |
get(K key)
Looks up and returns a cache value according to a given key.
|
V |
put(K key,
V value)
Places a key/value pair into the cache.
|
V |
remove(K key)
Removes a key from the cache.
|
int |
size()
Returns the number of elements in cache.
|
V put(K key, V value)
key
- Keyvalue
- Valuekey
or nullV get(K key)
null
is returned.V remove(K key)
key
- Keyvoid clear()
int size()
void execute(SmartCache.SmartCacheTask<K,V> task)
task
- The task to execute.Copyright © 2020 Hitachi Vantara. All rights reserved.