Skip to content

refactor: lru-cache maxAge to ttl #8039

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jun 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 13 additions & 6 deletions package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"jwks-rsa": "2.1.3",
"ldapjs": "2.3.2",
"lodash": "4.17.21",
"lru-cache": "6.0.0",
"lru-cache": "7.10.1",
"mime": "3.0.0",
"mongodb": "4.6.0",
"mustache": "4.2.0",
Expand Down
2 changes: 1 addition & 1 deletion src/Adapters/Cache/LRUCache.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export class LRUCache {
constructor({ ttl = defaults.cacheTTL, maxSize = defaults.cacheMaxSize }) {
this.cache = new LRU({
max: maxSize,
maxAge: ttl,
ttl,
});
}

Expand Down
2 changes: 1 addition & 1 deletion src/LiveQuery/ParseLiveQueryServer.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ class ParseLiveQueryServer {
// The main benefit is to be able to reuse the same user / session token resolution.
this.authCache = new LRU({
max: 500, // 500 concurrent
maxAge: config.cacheTimeout,
ttl: config.cacheTimeout,
});
// Initialize websocket server
this.parseWebSocketServer = new ParseWebSocketServer(
Expand Down
2 changes: 1 addition & 1 deletion src/LiveQuery/SessionTokenCache.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class SessionTokenCache {
constructor(timeout: number = 30 * 24 * 60 * 60 * 1000, maxSize: number = 10000) {
this.cache = new LRU({
max: maxSize,
maxAge: timeout,
ttl: timeout,
});
}

Expand Down