Package mondrian.rolap.cache
Class SmartCacheImpl<K,V>
java.lang.Object
mondrian.rolap.cache.SmartCacheImpl<K,V>
- All Implemented Interfaces:
SmartCache<K,V>
- Direct Known Subclasses:
HardSmartCache,SoftSmartCache
A base implementation of the
SmartCache interface which
enforces synchronization with a ReadWrite lock.-
Nested Class Summary
Nested classes/interfaces inherited from interface mondrian.rolap.cache.SmartCache
SmartCache.SmartCacheTask<K,V> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()Clears the contents of this cache.protected abstract voidvoidexecute(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.protected abstract VMust provide an iterator on the contents of the cache.Places a key/value pair into the cache.protected abstract VRemoves a key from the cache.protected abstract VremoveImpl(K key) intsize()Returns the number of elements in cache.protected abstract intsizeImpl()
-
Constructor Details
-
SmartCacheImpl
public SmartCacheImpl()
-
-
Method Details
-
iteratorImpl
Must provide an iterator on the contents of the cache. It does not need to be thread safe because we will handle that inSmartCacheImpl. -
putImpl
-
getImpl
-
removeImpl
-
clearImpl
protected abstract void clearImpl() -
sizeImpl
protected abstract int sizeImpl() -
put
Description copied from interface:SmartCachePlaces a key/value pair into the cache.- Specified by:
putin interfaceSmartCache<K,V> - Parameters:
key- Keyvalue- Value- Returns:
- the previous value of
keyor null
-
get
Description copied from interface:SmartCacheLooks 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.- Specified by:
getin interfaceSmartCache<K,V>
-
remove
Description copied from interface:SmartCacheRemoves a key from the cache.- Specified by:
removein interfaceSmartCache<K,V> - Parameters:
key- Key- Returns:
- Previous value associated with the key
-
clear
public void clear()Description copied from interface:SmartCacheClears the contents of this cache.- Specified by:
clearin interfaceSmartCache<K,V>
-
size
public int size()Description copied from interface:SmartCacheReturns the number of elements in cache.- Specified by:
sizein interfaceSmartCache<K,V>
-
execute
Description copied from interface:SmartCacheExecutes a task over the contents of the cache and guarantees exclusive write access while processing.- Specified by:
executein interfaceSmartCache<K,V> - Parameters:
task- The task to execute.
-