cachette

Creator: coderz1093

Last updated:

0 purchases

cachette Image
cachette Images

Languages

Categories

Add to Cart

Description:

cachette

Cachette #
A simple in-memory cache.
Cachette is a very simple cache tool designed to fulfil the most basic use cases in an elegant way.
What Cachette does:

Stores and retrieves key-value pairs in memory.
Evicts excess values depending on the eviction policy. It currently supports first in, first out (FIFO), last in, first out (LIFO), random eviction, least recently used (LRU), most recently used (MRU), least frequently used (LFU), and most frequently used (MFU).
Provides an elegant interface including streams and callbacks.
Supports a 'user' model of cache entry ownership.
Exposes lists of keys, values and entries, which can be queried with functions such as where.
Doesn't require any await calls.

If you need to support more complex uses, you might want to consider using stash.
Basic Usage #
final cache = Cachette<int, String>(3); // The positional parameter is size.
cache[0] = 'zero';
cache.add(1, 'one');
cache[2] = 'two';
print(cache[0]); // 'zero'
print(cache.get(2)); // Result(ok, CacheEntry(2, 'two'))
cache[3] = 'three';
print(cache.keys); // [0, 2, 3] - 1 was evicted under the default policy (LRU)
copied to clipboard

License

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product:

Customer Reviews

There are no reviews.