receptacle
Advanced tools
Comparing version 0.1.0 to 0.1.1
module.exports = Receptacle; | ||
var cache = Receptacle.prototype; | ||
var counter = new Date % 1e9; | ||
function getUID () { return (Math.random() * 1e9 >>> 0) + (counter++); } | ||
/** | ||
@@ -14,2 +17,3 @@ * Creates a cache with a maximum key size. | ||
options = options || {}; | ||
this.id = options.id || getUID(); | ||
this.max = options.max || Infinity; | ||
@@ -16,0 +20,0 @@ this.items = options.items || []; |
{ | ||
"name": "receptacle", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"description": "In memory cache lru cache with ttl support.", | ||
@@ -5,0 +5,0 @@ "author": "Dylan Piercey <pierceydylan@gmail.com>", |
@@ -45,5 +45,8 @@ # Receptacle. | ||
###`Receptacle({ max=Infinity, items=[] })` | ||
###`Receptacle({ max=Infinity, items=[], id=# })` | ||
Create a new cache. | ||
###`#id` | ||
Each cache is assigned a unique id for organizing, you can optionally provide an id during instanciation. | ||
###`#max` | ||
@@ -50,0 +53,0 @@ Get the maximum size of the cache (default of Infinity). |
@@ -12,2 +12,3 @@ var assert = require("assert"); | ||
assert.equal(cache.has("b"), true); | ||
console.log(cache); | ||
}); | ||
@@ -14,0 +15,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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
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
9071
223
82
1