decaf::util::LRUCache< K, V, HASHCODE > Class Template Reference
A Basic Least Recently Used (LRU) Cache Map.
More...
#include <src/main/decaf/util/LRUCache.h>
Public Member Functions |
| | LRUCache () |
| | Default constructor for an LRU Cache The default capacity is 10000.
|
| | LRUCache (int maximumCacheSize) |
| | Constructs a LRUCache with a maximum capacity.
|
| | LRUCache (int initialCapacity, int maximumCacheSize, float loadFactor, bool accessOrder) |
| | Constructs an empty LRUCache instance with the specified initial capacity, maximumCacheSize, load factor and ordering mode.
|
| virtual | ~LRUCache () |
| int | getMaxCacheSize () const |
| | Gets the currently configured Max Cache Size setting.
|
| void | setMaxCacheSize (int size) |
| | Sets the maximum size allowed for this LRU Cache.
|
Protected Member Functions |
| virtual bool | removeEldestEntry (const MapEntry< K, V > &eldest DECAF_UNUSED) |
Protected Attributes |
| int | maxCacheSize |
Detailed Description
template<typename K, typename V, typename HASHCODE = HashCode<K>>
class decaf::util::LRUCache< K, V, HASHCODE >
A Basic Least Recently Used (LRU) Cache Map.
This LRUCache implements the LinkedHashMap class so all the standard Map operations are provided. When the sive of this LRUCache map exceeds the specified maxCacheSize value then by default the oldest entry is evicted from the Cache.
Subclasses can override the LinkedHashMap::onEviction method to perform custom cache eviction processing.
- Since:
- 1.0
Constructor & Destructor Documentation
template<typename K , typename V , typename HASHCODE = HashCode<K>>
Default constructor for an LRU Cache The default capacity is 10000.
template<typename K , typename V , typename HASHCODE = HashCode<K>>
Constructs a LRUCache with a maximum capacity.
- Parameters:
-
| maximumCacheSize | The maximum number of cached entries before eviction begins. |
template<typename K , typename V , typename HASHCODE = HashCode<K>>
Constructs an empty LRUCache instance with the specified initial capacity, maximumCacheSize, load factor and ordering mode.
- Parameters:
-
| initialCapacity | The initial capacity of the LRUCache. |
| maximumCacheSize | The maximum number of cached entries before eviction begins. |
| loadFactor | the load factor. The initial load factor for this LRUCache. |
| accessOrder | The ordering mode - true for access-order, false for insertion-order. |
- Exceptions:
-
| IllegalArgumentException | if the initial capacity is negative or the load factor is non-positive. |
template<typename K , typename V , typename HASHCODE = HashCode<K>>
Member Function Documentation
template<typename K , typename V , typename HASHCODE = HashCode<K>>
template<typename K , typename V , typename HASHCODE = HashCode<K>>
| virtual bool decaf::util::LRUCache< K, V, HASHCODE >::removeEldestEntry |
( |
const MapEntry< K, V > &eldest |
DECAF_UNUSED |
) |
[inline, protected, virtual] |
template<typename K , typename V , typename HASHCODE = HashCode<K>>
Field Documentation
template<typename K , typename V , typename HASHCODE = HashCode<K>>
The documentation for this class was generated from the following file: