New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More

@luolapeikko/cache-types

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@luolapeikko/cache-types

Typescript cache interfaces

0.0.7
Version published
Weekly downloads
27
2600%
Maintainers
0
Weekly downloads
 
Created

@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

FAQs

Package last updated on 13 Oct 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts