cachem
Key-value caches for R
cachem provides R objects for creating and managing key-value caches with automatic memory and age-based pruning to prevent unbounded growth. It offers both in-memory and disk-based storage options that can be used interchangeably through a consistent API.
The package handles cache misses by returning a sentinel value rather than NULL or throwing exceptions, which simplifies error handling and prevents race conditions in multi-process scenarios. It supports automatic eviction policies (LRU and FIFO), customizable size and age limits, and can layer multiple caches together to create multi-level storage hierarchies. Memory caches avoid serialization overhead and preserve object references, while disk caches enable larger storage capacity and can be shared across multiple R processes using the same directory.



