The maximum number of cache entries before an item is evicted. Zero means no limit.
Optional callback function that takes key/value parameters, to be executed when an entry is purged from the cache.
Adds a value to the cache.
Adds a value to the cache. If the key already exists, the entry's value is updated.
Removes the entry with the given key from the cache.
Removes the entry with the given key from the cache. Does nothing if the key does not exist in the cache.
Adds a value to the cache.
Adds a value to the cache. If the key already exists, the entry's value is updated.
Optionally gets the key's value from the cache.
Optionally gets the key's value from the cache.
Gets the number of entries currently held in the cache.
Removes the entry with the given key from the cache.
Removes the entry with the given key from the cache. Does nothing if the key does not exist in the cache.
Removes the oldest entry from the cache.
Removes the oldest entry from the cache. Does nothing if the cache is empty.
A simple LRU cache that is not safe for concurrent access.