ns-lru
TypeScript icon, indicating that this package has built-in type declarations

0.0.1-4 • Public • Published

ns-lru

Key-Value cache with Keyv and NodeSite.eu as storage backends

Installation

Install ns-lru using yarn add ns-lru

Install a storage adapter

Usage

import LRU from 'ns-lru';

const options = {
	namespace: 'some_namespace',
	// I suggest using a simple, alphanumerical name
	store: 'sqlite://some/local/file.db',
	// Supports any Map(), Redis, Mongo, SQLite, Postgres, MySQL,
	// Dynamo, FireStore, MSSQL, memcache, and even another ns-lru.
	ttl: 3600000,
	// How long should data be held for? (ms)
	maxSize: 1000,
	// How many items should be stored in RAM?
};

const lru = new LRU<V>(options);

lru.get(key: K) => Promise<V>;
lru.set(key: K, val: V) => lru;

Readme

Keywords

none

Package Sidebar

Install

npm i ns-lru

Weekly Downloads

4

Version

0.0.1-4

License

GPL-3.0-or-later

Unpacked Size

43.8 kB

Total Files

9

Last publish

Collaborators

  • realprokopschield