mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-16 02:36:16 +01:00
Update to lru-cache@^7 (#10815)
* chore(deps): bump lru-cache from 6.0.0 to 7.13.1 in /install Bumps [lru-cache](https://github.com/isaacs/node-lru-cache) from 6.0.0 to 7.13.1. - [Release notes](https://github.com/isaacs/node-lru-cache/releases) - [Changelog](https://github.com/isaacs/node-lru-cache/blob/main/CHANGELOG.md) - [Commits](https://github.com/isaacs/node-lru-cache/compare/v6.0.0...v7.13.1) --- updated-dependencies: - dependency-name: lru-cache dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> * fix(lru-cache): remove unneeded `length` params for cache creation, as `maxSize` was not used in those init calls, also renamed some methods to match new method names in lru-cache [breaking] Added deprecation notices for old params * fix: replace three direct calls to lru-cache with call to cacheCreate, moved cache creation call in uploads to run on first init as config is not populated at lib init * test: move configs init above cache reset calls in databasemock * move some more code above cache clear * refactor: remove unused * test: lru * test: more debug * test: on more test * use await helpers.uploadFile * fix: tests remove logs * fix: acp cache page * fix: add in one more guard again cache instantiation with `length` prop but no `maxSize` prop * fix(deps): bump markdown Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Barış Soner Uşaklı <barisusakli@gmail.com>
This commit is contained in:
@@ -4,7 +4,6 @@ const cronJob = require('cron').CronJob;
|
||||
const winston = require('winston');
|
||||
const nconf = require('nconf');
|
||||
const crypto = require('crypto');
|
||||
const LRU = require('lru-cache');
|
||||
const util = require('util');
|
||||
const _ = require('lodash');
|
||||
|
||||
@@ -15,6 +14,7 @@ const utils = require('./utils');
|
||||
const plugins = require('./plugins');
|
||||
const meta = require('./meta');
|
||||
const pubsub = require('./pubsub');
|
||||
const cacheCreate = require('./cacheCreate');
|
||||
|
||||
const Analytics = module.exports;
|
||||
|
||||
@@ -37,10 +37,9 @@ let ipCache;
|
||||
const runJobs = nconf.get('runJobs');
|
||||
|
||||
Analytics.init = async function () {
|
||||
ipCache = new LRU({
|
||||
ipCache = cacheCreate({
|
||||
max: parseInt(meta.config['analytics:maxCache'], 10) || 500,
|
||||
length: function () { return 1; },
|
||||
maxAge: 0,
|
||||
ttl: 0,
|
||||
});
|
||||
|
||||
new cronJob('*/10 * * * * *', (async () => {
|
||||
|
||||
Reference in New Issue
Block a user