New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

tiny-ttl-cache

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tiny-ttl-cache

Simple TTL cache. put and get.

latest
Source
npmnpm
Version
1.0.1
Version published
Maintainers
1
Created
Source

NPM version Build Status Dependency Status

Simple TTL cache. put and get.

Suitable for use in browsers and Node.js.

Install

$ npm install --save tiny-ttl-cache

Usage

var TTLCache = require('tiny-ttl-cache');

var maxSize = 100;
var timeToLive = 10 * 1000; // 10s in ms

var cache = new TTLCache(maxSize, timeToLive);
cache.put('key', 'value');
cache.get('key'); // returns 'value'

// 10 seconds later
cache.get('key'); // returns null

cache.flush(); // Empties the cache

TTL Eviction Policy

Once the cache reaches its maximum size, the item with the shortest TTL is removed.

Development

npm install
npm test

License

MIT © Andy Hume

Keywords

tiny-ttl-cache

FAQs

Package last updated on 29 Feb 2016

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