Comparing version 1.0.0 to 1.0.1
@@ -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 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
5092
30