@luolapeikko/cache-types
Typescript Cache interfaces.
Cache interface is a simple Map like key-value interface with basic operations like get
, set
, has
, delete
and clear
with cache related options like "set" method to add entry ttl to the cache and "expires" method to get current entry ttl.
Example
import {type ICache} from '@luolapeikko/cache-types';
function foo(cache: ICache<string>) {
const value = cache.get('key');
cache.set('key', 'value' );
cache.has('key');
cache.expires('key');
cache.delete('key');
cache.clear();
cache.size();
}