Package mondrian.rolap.cache
Interface SmartCache<K,V>
-
- All Known Implementing Classes:
HardSmartCache,SmartCacheImpl,SoftSmartCache
public interface SmartCache<K,V>Defines a cache API. Implementations exist for hard and soft references.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.
- Since:
- Nov 21, 2005
- Author:
- av
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interfaceSmartCache.SmartCacheTask<K,V>Defines a task to be run over the entries of the cache.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidclear()Clears the contents of this cache.voidexecute(SmartCache.SmartCacheTask<K,V> task)Executes a task over the contents of the cache and guarantees exclusive write access while processing.Vget(K key)Looks up and returns a cache value according to a given key.Vput(K key, V value)Places a key/value pair into the cache.Vremove(K key)Removes a key from the cache.intsize()Returns the number of elements in cache.
-
-
-
Method Detail
-
put
V put(K key, V value)
Places a key/value pair into the cache.- Parameters:
key- Keyvalue- Value- Returns:
- the previous value of
keyor null
-
get
V get(K key)
Looks up and returns a cache value according to a given key. If the cache does not correspond an entry corresponding to the key,nullis returned.
-
remove
V remove(K key)
Removes a key from the cache.- Parameters:
key- Key- Returns:
- Previous value associated with the key
-
clear
void clear()
Clears the contents of this cache.
-
size
int size()
Returns the number of elements in cache.
-
execute
void execute(SmartCache.SmartCacheTask<K,V> task)
Executes a task over the contents of the cache and guarantees exclusive write access while processing.- Parameters:
task- The task to execute.
-
-