Skip to content

Commit

Permalink
refactor: lru-cache maxAge to ttl (#8039)
Browse files Browse the repository at this point in the history
  • Loading branch information
Moumouls authored Jun 13, 2022
1 parent 5f7d392 commit 72fac8a
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 10 deletions.
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

0 comments on commit 72fac8a

Please sign in to comment.