@@ -23,8 +23,7 @@ import express from 'express';
2323import * as ejs from 'ejs' ;
2424import * as compression from 'compression' ;
2525import expressStaticGzip from 'express-static-gzip' ;
26- /* eslint-enable import/no-namespace */
27- import LRU from 'lru-cache' ;
26+ import { LRUCache } from 'lru-cache' ;
2827import { isbot } from 'isbot' ;
2928import { createCertificate } from 'pem' ;
3029import { createServer } from 'https' ;
@@ -72,10 +71,10 @@ const cookieParser = require('cookie-parser');
7271const 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
8180extendEnvironmentWithAppConfig ( 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