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 Details

    • initialize

      void initialize(CompositeCache<K,V> cache)
      Initialize the memory cache

      Parameters:
      cache - The cache (region) this memory store is attached to.
    • dispose

      void dispose() throws IOException
      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

      boolean remove(K key) throws IOException
      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

      void removeAll() throws IOException
      Removes all cached items from the cache.

      Throws:
      IOException - Description of the Exception
    • freeElements

      int freeElements(int numberToFree) throws IOException
      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

      ICacheElement<K,V> get(K key) throws IOException
      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

      void waterfal(ICacheElement<K,V> ce) throws IOException
      Spools the item contained in the provided element to disk

      Parameters:
      ce - Description of the Parameter
      Throws:
      IOException - Description of the Exception
    • update

      void update(ICacheElement<K,V> ce) throws IOException
      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