🚀 Big News:Socket Has Acquired Secure Annex.Learn More →
Socket
Book a DemoSign in
Socket

ttl-cache

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ttl-cache

Simple in-memory object cache with TTL based per-item expiry

latest
Source
npmnpm
Version
1.0.2
Version published
Maintainers
1
Created
Source

node-ttl-cache

Simple in-memory object cache with TTL based per-item expiry

Installation:

npm install ttl-cache

Usage:

var Cache = require('ttl-cache'),
    cache = new Cache();

old_value = cache.set(key, value); // Set a value (returns old)
new_value = cache.get(key); // Get a value
values = cache.mget(key1, key2); // Get multiple values at once
cache.del(key1, key2); // Delete one or more values at once
cache.ttl(key, 3); // Change the ttl of a value (in seconds)
cache.flush(); // Wipe the lot

Options:

var cache({
        ttl: 300,       // Number of seconds to keep entries
        interval: 60    // Cleaning interval
    });

License:

Project code is released under CC0 license:

CC0

Keywords

memory

FAQs

Package last updated on 06 Dec 2013

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