refactor: lru-cache maxAge to ttl (#8039)
This commit is contained in:
19
package-lock.json
generated
19
package-lock.json
generated
@@ -9170,12 +9170,9 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"lru-cache": {
|
"lru-cache": {
|
||||||
"version": "6.0.0",
|
"version": "7.10.1",
|
||||||
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-7.10.1.tgz",
|
||||||
"integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==",
|
"integrity": "sha512-BQuhQxPuRl79J5zSXRP+uNzPOyZw2oFI9JLRQ80XswSvg21KMKNtQza9eF42rfI/3Z40RvzBdXgziEkudzjo8A=="
|
||||||
"requires": {
|
|
||||||
"yallist": "^4.0.0"
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
"lru-memoizer": {
|
"lru-memoizer": {
|
||||||
"version": "2.1.4",
|
"version": "2.1.4",
|
||||||
@@ -14421,6 +14418,16 @@
|
|||||||
"integrity": "sha512-QlYTucUYOews+WeEujDoEGziz4K6c47V/Bd+LjSSYcA94p+DmINdf7ncaUinThfvZyu13lN9OY1XDxt8C0Tw0g==",
|
"integrity": "sha512-QlYTucUYOews+WeEujDoEGziz4K6c47V/Bd+LjSSYcA94p+DmINdf7ncaUinThfvZyu13lN9OY1XDxt8C0Tw0g==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"lru-cache": "^6.0.0"
|
"lru-cache": "^6.0.0"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"lru-cache": {
|
||||||
|
"version": "6.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz",
|
||||||
|
"integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==",
|
||||||
|
"requires": {
|
||||||
|
"yallist": "^4.0.0"
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"semver-compare": {
|
"semver-compare": {
|
||||||
|
|||||||
@@ -41,7 +41,7 @@
|
|||||||
"jwks-rsa": "2.1.3",
|
"jwks-rsa": "2.1.3",
|
||||||
"ldapjs": "2.3.2",
|
"ldapjs": "2.3.2",
|
||||||
"lodash": "4.17.21",
|
"lodash": "4.17.21",
|
||||||
"lru-cache": "6.0.0",
|
"lru-cache": "7.10.1",
|
||||||
"mime": "3.0.0",
|
"mime": "3.0.0",
|
||||||
"mongodb": "4.6.0",
|
"mongodb": "4.6.0",
|
||||||
"mustache": "4.2.0",
|
"mustache": "4.2.0",
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ export class LRUCache {
|
|||||||
constructor({ ttl = defaults.cacheTTL, maxSize = defaults.cacheMaxSize }) {
|
constructor({ ttl = defaults.cacheTTL, maxSize = defaults.cacheMaxSize }) {
|
||||||
this.cache = new LRU({
|
this.cache = new LRU({
|
||||||
max: maxSize,
|
max: maxSize,
|
||||||
maxAge: ttl,
|
ttl,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ class ParseLiveQueryServer {
|
|||||||
// The main benefit is to be able to reuse the same user / session token resolution.
|
// The main benefit is to be able to reuse the same user / session token resolution.
|
||||||
this.authCache = new LRU({
|
this.authCache = new LRU({
|
||||||
max: 500, // 500 concurrent
|
max: 500, // 500 concurrent
|
||||||
maxAge: config.cacheTimeout,
|
ttl: config.cacheTimeout,
|
||||||
});
|
});
|
||||||
// Initialize websocket server
|
// Initialize websocket server
|
||||||
this.parseWebSocketServer = new ParseWebSocketServer(
|
this.parseWebSocketServer = new ParseWebSocketServer(
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ class SessionTokenCache {
|
|||||||
constructor(timeout: number = 30 * 24 * 60 * 60 * 1000, maxSize: number = 10000) {
|
constructor(timeout: number = 30 * 24 * 60 * 60 * 1000, maxSize: number = 10000) {
|
||||||
this.cache = new LRU({
|
this.cache = new LRU({
|
||||||
max: maxSize,
|
max: maxSize,
|
||||||
maxAge: timeout,
|
ttl: timeout,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user