Skip to content

Commit

Permalink
Merge pull request #11935 from bbc/dependabot/npm_and_yarn/lru-cache-…
Browse files Browse the repository at this point in the history
…11.0.0

WSTEAMA-1398: Bump lru-cache from 7.7.1 to 11.0.1
  • Loading branch information
karinathomasbbc authored Oct 9, 2024
2 parents 52633ff + 3f5e716 commit 74e1179
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 12 deletions.
Binary file not shown.
Binary file not shown.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@
"isomorphic-fetch": "3.0.0",
"jalaali-js": "1.2.7",
"js-cookie": "3.0.5",
"lru-cache": "7.7.1",
"lru-cache": "11.0.1",
"moment": "2.30.1",
"moment-timezone": "0.5.45",
"morgan": "1.10.0",
Expand Down
4 changes: 2 additions & 2 deletions src/app/lib/utilities/getToggles/withCache.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Cache from 'lru-cache';
import { LRUCache } from 'lru-cache';
import getToggles from '.';
import { getEnvConfig } from '../getEnvConfig';

Expand All @@ -10,7 +10,7 @@ const cacheTTL = parseInt(
getEnvConfig().SIMORGH_CONFIG_CACHE_MAX_AGE_SECONDS ?? 300,
10,
);
const cache = new Cache({ max: cacheMaxItems, ttl: cacheTTL * 1000 });
const cache = new LRUCache({ max: cacheMaxItems, ttl: cacheTTL * 1000 });

const withCache = async service => getToggles(service, cache);

Expand Down
6 changes: 3 additions & 3 deletions src/app/lib/utilities/getToggles/withCache.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Cache from 'lru-cache';
import { LRUCache } from 'lru-cache';
import withCache from './withCache';
import getToggles from '.';

Expand All @@ -25,10 +25,10 @@ describe('withCache', () => {
withCache('pidgin');

// ensure we only have once instance of the cache
expect(Cache).toHaveBeenCalledTimes(1);
expect(LRUCache).toHaveBeenCalledTimes(1);

// ensure the same cache is used for multiple calls
const mockCacheInstance = Cache.mock.instances[0];
const mockCacheInstance = LRUCache.mock.instances[0];
expect(getToggles).toHaveBeenNthCalledWith(1, 'mundo', mockCacheInstance);
expect(getToggles).toHaveBeenNthCalledWith(2, 'pidgin', mockCacheInstance);
});
Expand Down
2 changes: 1 addition & 1 deletion src/app/routes/utils/fetchPageData/withCache.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import LRUCache from 'lru-cache';
import { LRUCache } from 'lru-cache';
import fetchPageData from '.';

const cacheMaxItems = 400;
Expand Down
10 changes: 5 additions & 5 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -13214,10 +13214,10 @@ __metadata:
languageName: node
linkType: hard

"lru-cache@npm:7.7.1":
version: 7.7.1
resolution: "lru-cache@npm:7.7.1"
checksum: 10/4b9961764bb5b7ae06f5857a20f645fb0f05bc3c4d66c67d35f6aacad98b3b14a48c2b879517d97d47e41cfa4c2d64fec627b118deccd661d3961716de75abe1
"lru-cache@npm:11.0.1":
version: 11.0.1
resolution: "lru-cache@npm:11.0.1"
checksum: 10/26688a1b2a4d7fb97e9ea1ffb15348f1ab21b7110496814f5ce9190d50258fbba8c1444ae7232876deae1fc54adb230aa63dd1efc5bd47f240620ba8bf218041
languageName: node
linkType: hard

Expand Down Expand Up @@ -16333,7 +16333,7 @@ __metadata:
jest-silent-reporter: "npm:0.6.0"
js-cookie: "npm:3.0.5"
jsdom: "npm:24.1.1"
lru-cache: "npm:7.7.1"
lru-cache: "npm:11.0.1"
minimist: "npm:1.2.8"
mkdirp: "npm:3.0.1"
mocha-junit-reporter: "npm:2.2.1"
Expand Down

0 comments on commit 74e1179

Please sign in to comment.