Comparing version 1.0.0 to 1.1.0
@@ -19,5 +19,4 @@ class Cache extends Map { | ||
set(key, content, maxAge) { | ||
set(key, content, maxAge = this.maxAge) { | ||
this.has(key) && this.delete(key); | ||
maxAge = maxAge !== void 0 ? maxAge : this.maxAge; | ||
(this.size + 1 > this.max) && this.delete(this.keys().next().value); | ||
@@ -24,0 +23,0 @@ let expires = maxAge > -1 && (maxAge + Date.now()); |
{ | ||
"name": "tmp-cache", | ||
"version": "1.0.0", | ||
"version": "1.1.0", | ||
"repository": "lukeed/tmp-cache", | ||
"description": "A least-recently-used cache manager in 35 lines of code", | ||
"description": "A least-recently-used cache in 35 lines of code", | ||
"main": "lib/index.js", | ||
"types": "index.d.ts", | ||
"license": "MIT", | ||
@@ -11,3 +12,3 @@ "author": { | ||
"email": "luke.edwards05@gmail.com", | ||
"url": "lukeed.com" | ||
"url": "https://lukeed.com" | ||
}, | ||
@@ -18,5 +19,6 @@ "engines": { | ||
"scripts": { | ||
"test": "tape test/*.js | tap-spec" | ||
"test": "uvu test" | ||
}, | ||
"files": [ | ||
"*.d.ts", | ||
"lib" | ||
@@ -31,5 +33,4 @@ ], | ||
"devDependencies": { | ||
"tap-spec": "^4.1.1", | ||
"tape": "^4.8.0" | ||
"uvu": "0.3.3" | ||
} | ||
} |
@@ -1,4 +0,4 @@ | ||
# tmp-cache [![Build Status](https://travis-ci.org/lukeed/tmp-cache.svg?branch=master)](https://travis-ci.org/lukeed/tmp-cache) | ||
# tmp-cache ![CI](https://github.com/lukeed/tmp-cache/workflows/CI/badge.svg) [![codecov](https://badgen.net/codecov/c/github/lukeed/tmp-cache)](https://codecov.io/gh/lukeed/tmp-cache) | ||
> A least-recently-used cache manager in 35 lines of code~! | ||
> A least-recently-used cache in 35 lines of code~! | ||
@@ -5,0 +5,0 @@ LRU caches operate on a first-in-first-out queue. This means that the first item is the oldest and will therefore be deleted once the `max` limit has been reached. |
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
7256
1
5
45