Class BlockDiskKeyStore<K>

java.lang.Object
org.apache.commons.jcs3.auxiliary.disk.block.BlockDiskKeyStore<K>

public class BlockDiskKeyStore<K> extends Object
This is responsible for storing the keys.
  • Field Details

    • logCacheName

      protected final String logCacheName
      The name to prefix log messages with.
    • blockDiskCache

      protected final BlockDiskCache<K,?> blockDiskCache
      we need this so we can communicate free blocks to the data store when keys fall off the LRU
  • Constructor Details

  • Method Details

    • clearMemoryMap

      protected void clearMemoryMap()
      This is mainly used for testing. It leave the disk in tact, and just clears memory.
    • entrySet

      public Set<Map.Entry<K,int[]>> entrySet()
      Gets the entry set.

      Returns:
      entry set.
    • get

      public int[] get(K key)
      gets the object for the key.

      Parameters:
      key -
      Returns:
      Object
    • isEmpty

      public boolean isEmpty()
      Tests emptiness (size == 0).
      Returns:
      Whether or not this is empty.
      Since:
      3.1
    • keySet

      public Set<K> keySet()
      Gets the key set.

      Returns:
      key set.
    • loadKeys

      protected void loadKeys()
      Loads the keys from the .key file. The keys are stored individually on disk. They are added one by one to an LRUMap.
    • put

      public void put(K key, int[] value)
      Puts a int[] in the keyStore.

      Parameters:
      key -
      value -
    • remove

      public int[] remove(K key)
      Remove by key.

      Parameters:
      key -
      Returns:
      BlockDiskElementDescriptor if it was present, else null
    • reset

      protected void reset()
      Resets the file and creates a new key map.
    • saveKeys

      protected void saveKeys()
      Saves key file to disk. This gets the LRUMap entry set and write the entries out one by one after putting them in a wrapper.
    • size

      public int size()
      Gets the size of the key hash.

      Returns:
      the number of keys.