@@ -24,8 +24,7 @@ import express from 'express';
2424import * as ejs from 'ejs' ;
2525import * as compression from 'compression' ;
2626import expressStaticGzip from 'express-static-gzip' ;
27- /* eslint-enable import/no-namespace */
28- import LRU from 'lru-cache' ;
27+ import { LRUCache } from 'lru-cache' ;
2928import { isbot } from 'isbot' ;
3029import { createCertificate } from 'pem' ;
3130import { createServer } from 'https' ;
@@ -73,10 +72,10 @@ const cookieParser = require('cookie-parser');
7372const appConfig : AppConfig = buildAppConfig ( join ( DIST_FOLDER , 'assets/config.json' ) ) ;
7473
7574// cache of SSR pages for known bots, only enabled in production mode
76- let botCache : LRU < string , any > ;
75+ let botCache : LRUCache < string , any > ;
7776
7877// cache of SSR pages for anonymous users. Disabled by default, and only available in production mode
79- let anonymousCache : LRU < string , any > ;
78+ let anonymousCache : LRUCache < string , any > ;
8079
8180// extend environment with app config for server
8281extendEnvironmentWithAppConfig ( environment , appConfig ) ;
@@ -349,7 +348,7 @@ function initCache() {
349348 // Initialize a new "least-recently-used" item cache (where least recently used pages are removed first)
350349 // See https://www.npmjs.com/package/lru-cache
351350 // When enabled, each page defaults to expiring after 1 day (defined in default-app-config.ts)
352- botCache = new LRU ( {
351+ botCache = new LRUCache ( {
353352 max : environment . cache . serverSide . botCache . max ,
354353 ttl : environment . cache . serverSide . botCache . timeToLive ,
355354 allowStale : environment . cache . serverSide . botCache . allowStale ,
@@ -361,7 +360,7 @@ function initCache() {
361360 // may expire pages more frequently.
362361 // When enabled, each page defaults to expiring after 10 seconds (defined in default-app-config.ts)
363362 // to minimize anonymous users seeing out-of-date content
364- anonymousCache = new LRU ( {
363+ anonymousCache = new LRUCache ( {
365364 max : environment . cache . serverSide . anonymousCache . max ,
366365 ttl : environment . cache . serverSide . anonymousCache . timeToLive ,
367366 allowStale : environment . cache . serverSide . anonymousCache . allowStale ,
@@ -438,7 +437,7 @@ function cacheCheck(req, res, next) {
438437 * @param next the next function
439438 * @returns cached copy (if found) or undefined (if not found)
440439 */
441- function checkCacheForRequest ( cacheName : string , cache : LRU < string , any > , req , res , next ) : any {
440+ function checkCacheForRequest ( cacheName : string , cache : LRUCache < string , any > , req , res , next ) : any {
442441 // Get the cache key for this request
443442 const key = getCacheKey ( req ) ;
444443
0 commit comments