record-cache
Advanced tools
Comparing version 0.0.0 to 1.0.0
18
index.js
@@ -86,3 +86,3 @@ var EMPTY = [] | ||
this._interval = setInterval(this._gc.bind(this), tick) | ||
if (this._interval) this._interval.unref() | ||
if (this._interval.unref) this._interval.unref() | ||
} | ||
@@ -112,4 +112,5 @@ } | ||
var b = this._stale.get(name) | ||
var offset = 0 | ||
var len = a.length + b.length | ||
var aLen = a.length | ||
var bLen = b.length | ||
var len = aLen + bLen | ||
@@ -120,12 +121,11 @@ if (n > len || !n) n = len | ||
for (var i = 0; i < n; i++) { | ||
var j = offset + Math.floor(Math.random() * (len - offset)) | ||
if (j < a.length) { | ||
var j = Math.floor(Math.random() * (aLen + bLen)) | ||
if (j < aLen) { | ||
result[i] = a[j].record | ||
swap(a, j, offset) | ||
swap(a, j, --aLen) | ||
} else { | ||
j -= a.length | ||
j -= aLen | ||
result[i] = b[j].record | ||
swap(b, j, offset) | ||
swap(b, j, --bLen) | ||
} | ||
offset++ | ||
} | ||
@@ -132,0 +132,0 @@ |
{ | ||
"name": "record-cache", | ||
"version": "0.0.0", | ||
"description": "WIP - nothing to see here", | ||
"version": "1.0.0", | ||
"description": "Cache optimised for record like things", | ||
"main": "index.js", | ||
"dependencies": {}, | ||
"devDependencies": { | ||
"standard": "^10.0.3" | ||
"standard": "^10.0.3", | ||
"tape": "^4.8.0" | ||
}, | ||
"scripts": { | ||
"test": "standard" | ||
"test": "standard && tape test.js" | ||
}, | ||
@@ -13,0 +14,0 @@ "repository": { |
# record-cache | ||
A cache optimised for record like things (`host:port`) | ||
Cache optimised for record like things like `host:port` or `domain.names`. | ||
@@ -9,2 +9,4 @@ ``` | ||
[![build status](https://travis-ci.org/mafintosh/record-cache.svg?branch=master)](https://travis-ci.org/mafintosh/record-cache) | ||
## Usage | ||
@@ -11,0 +13,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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
10863
7
275
0
83
2