0.0.7 • Published 9 months ago

@luolapeikko/cache-types v0.0.7

Weekly downloads
-
License
MIT
Repository
github
Last release
9 months ago

@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' /*, ttl: Date */);
	cache.has('key'); // true
	cache.expires('key'); // Date or undefined
	cache.delete('key');
	cache.clear();
	cache.size(); // 0
}

Full Documentation

0.0.3

9 months ago

0.0.2

9 months ago

0.0.5

9 months ago

0.0.4

9 months ago

0.0.7

9 months ago

0.0.6

9 months ago

0.0.1

10 months ago