Skip to content

Commit

Permalink
Updating LRU cache & updating unregister() to call cache.delete()
Browse files Browse the repository at this point in the history
…, refactoring `valid()` to use `String.includes()`
  • Loading branch information
avoidwork committed Jan 13, 2019
1 parent cbf8581 commit c217b4d
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions lib/etag.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,13 @@ class ETag {
}

unregister (key) {
this.cache.remove(key);
this.cache.delete(key);
}

valid (headers) {
const header = headers["cache-control"] || "";

return header === "" || (header.indexOf("no-cache") === -1 && header.indexOf("no-store") === -1);
return header.length === 0 || (header.includes("no-cache") === false && header.includes("no-store") === false); // eslint-disable-line no-extra-parens
}
}

Expand Down
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "tiny-etag",
"version": "2.0.9",
"version": "2.0.10",
"description": "ETag middleware",
"main": "index.js",
"scripts": {
Expand Down Expand Up @@ -29,7 +29,7 @@
"homepage": "http://avoidwork.github.io/tiny-etag/",
"dependencies": {
"murmurhash3js": "^3.0.1",
"tiny-lru": "^5.0.4"
"tiny-lru": "^5.1.0"
},
"devDependencies": {
"grunt": "^1.0.3",
Expand Down

0 comments on commit c217b4d

Please sign in to comment.