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

@luolapeikko/cache-types

Package Overview
Dependencies
Maintainers
0
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@luolapeikko/cache-types

Typescript cache interfaces

0.0.8
latest
Source
npm
Version published
Maintainers
0
Created
Source

@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

  • ICache
  • IAsyncCache

Keywords

cache

FAQs

Package last updated on 11 Jan 2025

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