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
Modifier and TypeInterfaceDescriptionstatic interface
Defines a task to be run over the entries of the cache. -
Method Summary
Modifier and TypeMethodDescriptionvoid
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.Looks up and returns a cache value according to a given key.Places a key/value pair into the cache.Removes a key from the cache.int
size()
Returns the number of elements in cache.
-
Method Details
-
put
Places a key/value pair into the cache.- Parameters:
key
- Keyvalue
- Value- Returns:
- the previous value of
key
or null
-
get
Looks up and returns a cache value according to a given key. If the cache does not correspond an entry corresponding to the key,null
is returned. -
remove
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
Executes a task over the contents of the cache and guarantees exclusive write access while processing.- Parameters:
task
- The task to execute.
-