Skip to content

Commit 3a3c8be

Browse files
committed
package.json: update lru-cache
1 parent 9b238a0 commit 3a3c8be

File tree

3 files changed

+13
-33
lines changed

3 files changed

+13
-33
lines changed

package-lock.json

Lines changed: 6 additions & 25 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
@@ -134,7 +134,7 @@
134134
"leaflet-providers": "^2.0.0",
135135
"leaflet.markercluster": "^1.5.3",
136136
"lodash-es": "^4.17.21",
137-
"lru-cache": "^7.14.1",
137+
"lru-cache": "^11.2.2",
138138
"markdown-it": "^13.0.1",
139139
"mirador": "^3.4.3",
140140
"mirador-dl-plugin": "^0.13.0",

server.ts

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,7 @@ import express from 'express';
2323
import * as ejs from 'ejs';
2424
import * as compression from 'compression';
2525
import expressStaticGzip from 'express-static-gzip';
26-
/* eslint-enable import/no-namespace */
27-
import LRU from 'lru-cache';
26+
import { LRUCache } from 'lru-cache';
2827
import { isbot } from 'isbot';
2928
import { createCertificate } from 'pem';
3029
import { createServer } from 'https';
@@ -72,10 +71,10 @@ const cookieParser = require('cookie-parser');
7271
const appConfig: AppConfig = buildAppConfig(join(DIST_FOLDER, 'assets/config.json'));
7372

7473
// cache of SSR pages for known bots, only enabled in production mode
75-
let botCache: LRU<string, any>;
74+
let botCache: LRUCache<string, any>;
7675

7776
// cache of SSR pages for anonymous users. Disabled by default, and only available in production mode
78-
let anonymousCache: LRU<string, any>;
77+
let anonymousCache: LRUCache<string, any>;
7978

8079
// extend environment with app config for server
8180
extendEnvironmentWithAppConfig(environment, appConfig);
@@ -348,7 +347,7 @@ function initCache() {
348347
// Initialize a new "least-recently-used" item cache (where least recently used pages are removed first)
349348
// See https://www.npmjs.com/package/lru-cache
350349
// When enabled, each page defaults to expiring after 1 day (defined in default-app-config.ts)
351-
botCache = new LRU( {
350+
botCache = new LRUCache( {
352351
max: environment.cache.serverSide.botCache.max,
353352
ttl: environment.cache.serverSide.botCache.timeToLive,
354353
allowStale: environment.cache.serverSide.botCache.allowStale,
@@ -360,7 +359,7 @@ function initCache() {
360359
// may expire pages more frequently.
361360
// When enabled, each page defaults to expiring after 10 seconds (defined in default-app-config.ts)
362361
// to minimize anonymous users seeing out-of-date content
363-
anonymousCache = new LRU( {
362+
anonymousCache = new LRUCache( {
364363
max: environment.cache.serverSide.anonymousCache.max,
365364
ttl: environment.cache.serverSide.anonymousCache.timeToLive,
366365
allowStale: environment.cache.serverSide.anonymousCache.allowStale,
@@ -437,7 +436,7 @@ function cacheCheck(req, res, next) {
437436
* @param next the next function
438437
* @returns cached copy (if found) or undefined (if not found)
439438
*/
440-
function checkCacheForRequest(cacheName: string, cache: LRU<string, any>, req, res, next): any {
439+
function checkCacheForRequest(cacheName: string, cache: LRUCache<string, any>, req, res, next): any {
441440
// Get the cache key for this request
442441
const key = getCacheKey(req);
443442

0 commit comments

Comments
 (0)