Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
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 - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

8

lib/cache.js

@@ -55,4 +55,4 @@ var events = require('events'),

this.options = {
ttl: 300,
clean_interval: 600
ttl: 300, // Default TTL 5 minutes.
clean_interval: 60 // Clean every minute.
};

@@ -124,3 +124,3 @@

this.data[key] = val;
ttl && (this.ttls[key] = +(new Date) + ttl);
ttl && (this.ttls[key] = +(new Date) + ttl * 1000);

@@ -161,3 +161,3 @@ ('undefined' !== typeof exists) || this.stats.keys++;

if ('undefined' !== typeof fetch(this, key)) {
this.ttls[key] = +(new Date) + ttl;
this.ttls[key] = +(new Date) + ttl * 1000;
}

@@ -164,0 +164,0 @@ };

{
"name": "ttl-cache",
"version": "1.0.0",
"version": "1.0.1",
"description": "Simple in-memory object cache with TTL based per-item expiry",

@@ -5,0 +5,0 @@ "main": "lib/cache.js",

@@ -6,2 +6,17 @@ node-ttl-cache

## Installation:
npm install ttl-cache
## Usage:
var cache = require('ttl-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
## License:

@@ -8,0 +23,0 @@

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc