Socket
Socket
Sign inDemoInstall

ttl-cache

Package Overview
Dependencies
0
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    ttl-cache

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


Version published
Maintainers
1
Install size
5.27 kB
Created

Readme

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

FAQs

Last updated on 06 Dec 2013

Did you know?

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc