Skip to content

Commit 95ab9e3

Browse files
committed
refactor: lru-cache maxAge to ttl
1 parent 0cd902b commit 95ab9e3

File tree

5 files changed

+24
-11
lines changed

5 files changed

+24
-11
lines changed

package-lock.json

Lines changed: 13 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
"jwks-rsa": "2.1.2",
4242
"ldapjs": "2.3.2",
4343
"lodash": "4.17.21",
44-
"lru-cache": "6.0.0",
44+
"lru-cache": "7.10.1",
4545
"mime": "3.0.0",
4646
"mongodb": "4.6.0",
4747
"mustache": "4.2.0",

src/Adapters/Cache/LRUCache.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export class LRUCache {
55
constructor({ ttl = defaults.cacheTTL, maxSize = defaults.cacheMaxSize }) {
66
this.cache = new LRU({
77
max: maxSize,
8-
maxAge: ttl,
8+
ttl,
99
});
1010
}
1111

src/LiveQuery/ParseLiveQueryServer.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,13 @@ import { ParsePubSub } from './ParsePubSub';
1010
import SchemaController from '../Controllers/SchemaController';
1111
import _ from 'lodash';
1212
import { v4 as uuidv4 } from 'uuid';
13-
import { runLiveQueryEventHandlers, getTrigger, runTrigger, resolveError, toJSONwithObjects } from '../triggers';
13+
import {
14+
runLiveQueryEventHandlers,
15+
getTrigger,
16+
runTrigger,
17+
resolveError,
18+
toJSONwithObjects,
19+
} from '../triggers';
1420
import { getAuthForSessionToken, Auth } from '../Auth';
1521
import { getCacheController } from '../Controllers';
1622
import LRU from 'lru-cache';
@@ -58,7 +64,7 @@ class ParseLiveQueryServer {
5864
// The main benefit is to be able to reuse the same user / session token resolution.
5965
this.authCache = new LRU({
6066
max: 500, // 500 concurrent
61-
maxAge: config.cacheTimeout,
67+
ttl: config.cacheTimeout,
6268
});
6369
// Initialize websocket server
6470
this.parseWebSocketServer = new ParseWebSocketServer(

src/LiveQuery/SessionTokenCache.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class SessionTokenCache {
1919
constructor(timeout: number = 30 * 24 * 60 * 60 * 1000, maxSize: number = 10000) {
2020
this.cache = new LRU({
2121
max: maxSize,
22-
maxAge: timeout,
22+
ttl: timeout,
2323
});
2424
}
2525

0 commit comments

Comments
 (0)