Interface IMemoryCache<K,V>
- All Known Implementing Classes:
AbstractDoubleLinkedListMemoryCache
,AbstractMemoryCache
,FIFOMemoryCache
,LHMLRUMemoryCache
,LRUMemoryCache
,MRUMemoryCache
,SoftReferenceMemoryCache
public interface IMemoryCache<K,V>
For the framework. Insures methods a MemoryCache needs to access.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
dispose()
Destroy the memory cacheint
freeElements
(int numberToFree) This instructs the memory cache to remove the numberToFree according to its eviction policy.Get an item from the cacheReturns the CacheAttributes for the region.Gets the cache hub / region that uses the MemoryCache.Get a set of the keys for all elements in the memory cache.Map<K,
ICacheElement<K, V>> getMultiple
(Set<K> keys) Gets multiple items from the cache based on the given set of keys.Get an item from the cache without effecting its order or last access timeint
getSize()
Get the number of elements contained in the memory storeReturns the historical and statistical data for a region's memory cache.void
initialize
(CompositeCache<K, V> cache) Initialize the memory cacheboolean
Removes an item from the cachevoid
Removes all cached items from the cache.void
Sets the CacheAttributes of the region.void
update
(ICacheElement<K, V> ce) Puts an item to the cache.void
waterfal
(ICacheElement<K, V> ce) Spools the item contained in the provided element to disk
-
Method Details
-
initialize
Initialize the memory cache- Parameters:
cache
- The cache (region) this memory store is attached to.
-
dispose
Destroy the memory cache- Throws:
IOException
-
getSize
int getSize()Get the number of elements contained in the memory store- Returns:
- Element count
-
getStatistics
Returns the historical and statistical data for a region's memory cache.- Returns:
- Statistics and Info for the Memory Cache.
-
getKeySet
Get a set of the keys for all elements in the memory cache.- Returns:
- a set of the key type TODO This should probably be done in chunks with a range passed in. This will be a problem if someone puts a 1,000,000 or so items in a region.
-
remove
Removes an item from the cache- Parameters:
key
- Identifies item to be removed- Returns:
- Description of the Return Value
- Throws:
IOException
- Description of the Exception
-
removeAll
Removes all cached items from the cache.- Throws:
IOException
- Description of the Exception
-
freeElements
This instructs the memory cache to remove the numberToFree according to its eviction policy. For example, the LRUMemoryCache will remove the numberToFree least recently used items. These will be spooled to disk if a disk auxiliary is available.- Parameters:
numberToFree
-- Returns:
- the number that were removed. if you ask to free 5, but there are only 3, you will get 3.
- Throws:
IOException
-
get
Get an item from the cache- Parameters:
key
- Description of the Parameter- Returns:
- Description of the Return Value
- Throws:
IOException
- Description of the Exception
-
getMultiple
Gets multiple items from the cache based on the given set of keys.- Parameters:
keys
-- Returns:
- a map of K key to ICacheElement<K, V> element, or an empty map if there is no data in cache for any of these keys
- Throws:
IOException
-
getQuiet
Get an item from the cache without effecting its order or last access time- Parameters:
key
- Description of the Parameter- Returns:
- The quiet value
- Throws:
IOException
- Description of the Exception
-
waterfal
Spools the item contained in the provided element to disk- Parameters:
ce
- Description of the Parameter- Throws:
IOException
- Description of the Exception
-
update
Puts an item to the cache.- Parameters:
ce
- Description of the Parameter- Throws:
IOException
- Description of the Exception
-
getCacheAttributes
Returns the CacheAttributes for the region.- Returns:
- The cacheAttributes value
-
setCacheAttributes
Sets the CacheAttributes of the region.- Parameters:
cattr
- The new cacheAttributes value
-
getCompositeCache
Gets the cache hub / region that uses the MemoryCache.- Returns:
- The cache value
-