Class BlockDiskKeyStore<K>
java.lang.Object
org.apache.commons.jcs3.auxiliary.disk.block.BlockDiskKeyStore<K>
This is responsible for storing the keys.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionclass
Class for recycling and lru.class
Class for recycling and lru. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final BlockDiskCache<K,
?> we need this so we can communicate free blocks to the data store when keys fall off the LRUprotected final String
The name to prefix log messages with. -
Constructor Summary
ConstructorsConstructorDescriptionBlockDiskKeyStore
(BlockDiskCacheAttributes cacheAttributes, BlockDiskCache<K, ?> blockDiskCache) Set the configuration options. -
Method Summary
Modifier and TypeMethodDescriptionprotected void
This is mainly used for testing.entrySet()
Gets the entry set.int[]
gets the object for the key.boolean
isEmpty()
Tests emptiness (size == 0).keySet()
Gets the key set.protected void
loadKeys()
Loads the keys from the .key file.void
Puts a int[] in the keyStore.int[]
Remove by key.protected void
reset()
Resets the file and creates a new key map.protected void
saveKeys()
Saves key file to disk.int
size()
Gets the size of the key hash.
-
Field Details
-
logCacheName
The name to prefix log messages with. -
blockDiskCache
we need this so we can communicate free blocks to the data store when keys fall off the LRU
-
-
Constructor Details
-
BlockDiskKeyStore
public BlockDiskKeyStore(BlockDiskCacheAttributes cacheAttributes, BlockDiskCache<K, ?> blockDiskCache) Set the configuration options.- Parameters:
cacheAttributes
-blockDiskCache
- used for freeing
-
-
Method Details
-
clearMemoryMap
This is mainly used for testing. It leave the disk in tact, and just clears memory. -
entrySet
Gets the entry set.- Returns:
- entry set.
-
get
gets the object for the key.- Parameters:
key
-- Returns:
- Object
-
isEmpty
Tests emptiness (size == 0).- Returns:
- Whether or not this is empty.
- Since:
- 3.1
-
keySet
Gets the key set.- Returns:
- key set.
-
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
Puts a int[] in the keyStore.- Parameters:
key
-value
-
-
remove
Remove by key.- Parameters:
key
-- Returns:
- BlockDiskElementDescriptor if it was present, else null
-
reset
Resets the file and creates a new key map. -
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
Gets the size of the key hash.- Returns:
- the number of keys.
-