If non-Empty
, specifies the load factor for the
backing java.util.HashMap
.
When a key-value pair is removed, the last thing that
happens is that these functions are invoked. Note that this happens
after expired
is invoked.
Remove the given key
and its associated value from the map.
Unsafe version of get
.
Override this method to implement a test to see if a particular element can be expired from the cache.
Override this method to implement a test to see if a particular element can be expired from the cache.
Check if the given key
exists in the map.
Check if the given key
exists in the map. A key may not be in the map
either if it was never added or if it has been expired.
Called when a key/value pair is removed, before the expiredFunc
.
Called when a key/value pair is removed, before the expiredFunc
.
Does nothing by default, override for custom functionality.
Fetches the given key, returning Empty
if the key does not exist in
the map.
Fetches the given key, returning Empty
if the key does not exist in
the map. A key may not be in the map either if it was never added or if it
has been expired.
Accessing a key this way will mark its value as most-recently-used.
Alias for -
.
Set the value
for the given key
in the map.
Set the value
for the given key
in the map.
Marks the given value
as the most recently used, and, if this key
is
new in the map and the map has grown beyond the specifiex maxSize
,
evicts the least-recently-used entries.
Updates the LRUMap
's current max size to newMaxSize
, evicting the
oldest entries if the size has shrunk.
Implements an LRU Hashmap. Given a size, this map will evict the least recently used item(s) when new items are added.
Note that
LRUMap
is not thread-safe.