arcache
A crate which implements a variety of caches with different eviction policies. All cache implementations are thread-safe and can be used in a multi-threaded environment. Cache implementations all share the Cache trait which means that they are interchangeable once instantiated.
The cache store values in an Arc (hence arccache) so that they can be shared between threads without needing to clone the value. Caches all implement an internal mutability pattern to make them easy to use in multi-threaded applications.
use ;
The Cache trait lets you write functions with generic signatures and swap cache implementations, this is useful if you want to uses multiple cache types with the same code.
use ;
use ;
Implemented caches
LRUCacheLFUCacheMRUCacheTTLCacheFIFOCacheLIFOCacheRandomReplacementCache
On the roadmap
ARCCacheLFUTTLCache(LFU with expiration)
Usage
See /examples for example usage. You can run these like so:
To add arcache to your project run cargo add arcache.