Skip to content

Commit ff1204a

Browse files
committedDec 6, 2023
deps: lru-cache@10.1.0
1 parent 71f70fa commit ff1204a

File tree

5 files changed

+71
-13
lines changed

5 files changed

+71
-13
lines changed
 

‎DEPENDENCIES.md

-1
Original file line numberDiff line numberDiff line change
@@ -441,7 +441,6 @@ graph LR;
441441
libnpmversion-->require-inject;
442442
libnpmversion-->semver;
443443
libnpmversion-->tap;
444-
lru-cache-->semver;
445444
lru-cache-->yallist;
446445
make-fetch-happen-->cacache;
447446
make-fetch-happen-->http-cache-semantics;

‎node_modules/lru-cache/dist/commonjs/index.js

+31
Original file line numberDiff line numberDiff line change
@@ -736,6 +736,37 @@ class LRUCache {
736736
}
737737
return deleted;
738738
}
739+
/**
740+
* Get the extended info about a given entry, to get its value, size, and
741+
* TTL info simultaneously. Like {@link LRUCache#dump}, but just for a
742+
* single key. Always returns stale values, if their info is found in the
743+
* cache, so be sure to check for expired TTLs if relevant.
744+
*/
745+
info(key) {
746+
const i = this.#keyMap.get(key);
747+
if (i === undefined)
748+
return undefined;
749+
const v = this.#valList[i];
750+
const value = this.#isBackgroundFetch(v)
751+
? v.__staleWhileFetching
752+
: v;
753+
if (value === undefined)
754+
return undefined;
755+
const entry = { value };
756+
if (this.#ttls && this.#starts) {
757+
const ttl = this.#ttls[i];
758+
const start = this.#starts[i];
759+
if (ttl && start) {
760+
const remain = ttl - (perf.now() - start);
761+
entry.ttl = remain;
762+
entry.start = Date.now();
763+
}
764+
}
765+
if (this.#sizes) {
766+
entry.size = this.#sizes[i];
767+
}
768+
return entry;
769+
}
739770
/**
740771
* Return an array of [key, {@link LRUCache.Entry}] tuples which can be
741772
* passed to cache.load()

‎node_modules/lru-cache/dist/esm/index.js

+31
Original file line numberDiff line numberDiff line change
@@ -733,6 +733,37 @@ export class LRUCache {
733733
}
734734
return deleted;
735735
}
736+
/**
737+
* Get the extended info about a given entry, to get its value, size, and
738+
* TTL info simultaneously. Like {@link LRUCache#dump}, but just for a
739+
* single key. Always returns stale values, if their info is found in the
740+
* cache, so be sure to check for expired TTLs if relevant.
741+
*/
742+
info(key) {
743+
const i = this.#keyMap.get(key);
744+
if (i === undefined)
745+
return undefined;
746+
const v = this.#valList[i];
747+
const value = this.#isBackgroundFetch(v)
748+
? v.__staleWhileFetching
749+
: v;
750+
if (value === undefined)
751+
return undefined;
752+
const entry = { value };
753+
if (this.#ttls && this.#starts) {
754+
const ttl = this.#ttls[i];
755+
const start = this.#starts[i];
756+
if (ttl && start) {
757+
const remain = ttl - (perf.now() - start);
758+
entry.ttl = remain;
759+
entry.start = Date.now();
760+
}
761+
}
762+
if (this.#sizes) {
763+
entry.size = this.#sizes[i];
764+
}
765+
return entry;
766+
}
736767
/**
737768
* Return an array of [key, {@link LRUCache.Entry}] tuples which can be
738769
* passed to cache.load()

‎node_modules/lru-cache/package.json

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "lru-cache",
33
"description": "A cache object that deletes the least-recently-used items.",
4-
"version": "10.0.2",
4+
"version": "10.1.0",
55
"author": "Isaac Z. Schlueter <i@izs.me>",
66
"keywords": [
77
"mru",
@@ -45,7 +45,10 @@
4545
}
4646
}
4747
},
48-
"repository": "git://github.com/isaacs/node-lru-cache.git",
48+
"repository": {
49+
"type": "git",
50+
"url": "git://github.com/isaacs/node-lru-cache.git"
51+
},
4952
"devDependencies": {
5053
"@tapjs/clock": "^1.1.16",
5154
"@types/node": "^20.2.5",
@@ -111,8 +114,5 @@
111114
}
112115
}
113116
},
114-
"type": "module",
115-
"dependencies": {
116-
"semver": "^7.3.5"
117-
}
117+
"type": "module"
118118
}

‎package-lock.json

+3-6
Original file line numberDiff line numberDiff line change
@@ -10248,13 +10248,10 @@
1024810248
}
1024910249
},
1025010250
"node_modules/lru-cache": {
10251-
"version": "10.0.2",
10252-
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.0.2.tgz",
10253-
"integrity": "sha512-Yj9mA8fPiVgOUpByoTZO5pNrcl5Yk37FcSHsUINpAsaBIEZIuqcCclDZJCVxqQShDsmYX8QG63svJiTbOATZwg==",
10251+
"version": "10.1.0",
10252+
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.1.0.tgz",
10253+
"integrity": "sha512-/1clY/ui8CzjKFyjdvwPWJUYKiFVXG2I2cY0ssG7h4+hwk+XOIX7ZSG9Q7TW8TW3Kp3BUSqgFWBLgL4PJ+Blag==",
1025410254
"inBundle": true,
10255-
"dependencies": {
10256-
"semver": "^7.3.5"
10257-
},
1025810255
"engines": {
1025910256
"node": "14 || >=16.14"
1026010257
}

0 commit comments

Comments
 (0)
Please sign in to comment.