In-memory LRU cache with TTL support
Ultra-low latency, limited by available RAM.
Best for hot data, session data, frequently accessed vectors.
Methods
Inherited methods
Method new()
Create a new MemoryCache
Arguments
config
CacheConfig object
Method set()
Set value in cache
Usage
MemoryCache$set(key, value, ttl = NULL)
Arguments
key
Cache key
value
Value to cache
ttl
Time to live
Method delete()
Delete key from cache
Method clear()
Clear cache
Method size()
Get cache size
Method cleanup_expired()
Cleanup expired entries
Usage
MemoryCache$cleanup_expired()
Returns
Integer count removed
Method clone()
The objects of this class are cloneable with this method.
Usage
MemoryCache$clone(deep = FALSE)
Arguments
deep
Whether to make a deep clone.