banyudu / webext-ttl-cache

TTL cache for web extensions.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

webext-ttl-cache

TTL cache for web extensions.

Usage

import { get, set, del, clear, keys, has } from 'webext-ttl-cache';

async function demo () {
  await set('foo', 'bar', 1000); // 1000ms TTL
  const value = await get('foo'); // 'bar'
  await has('foo'); // true
  const myKeys = await keys(); // ['foo']
  await del('foo'); // delete 'foo'
  await clear(); // delete all keys
}

Caution

This is an early stage project. Use at your own risk.

About

TTL cache for web extensions.

License:MIT License


Languages

Language:TypeScript 100.0%