Skip to content

Commit

Permalink
Merge pull request #43 from elbuo8/adjust-cache-size
Browse files Browse the repository at this point in the history
Add cache size
  • Loading branch information
joseluisdiaz authored Jul 18, 2023
2 parents 4900ddc + ff6bcbe commit 8159af8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class LimitdRedis extends EventEmitter {

this.db = new LimitDBRedis(_.pick(params, [
'uri', 'nodes', 'buckets', 'prefix', 'slotsRefreshTimeout', 'slotsRefreshInterval',
'password', 'tls', 'dnsLookup', 'globalTTL', 'cache', 'ping']));
'password', 'tls', 'dnsLookup', 'globalTTL', 'cacheSize', 'ping']));

this.db.on('error', (err) => {
this.emit('error', err);
Expand Down
4 changes: 2 additions & 2 deletions lib/db.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,8 @@ class LimitDBRedis extends EventEmitter {
this.emit('node error', err, node);
});

this.cache = config.cache || new TTLCache({
max: 1000,
this.cache = new TTLCache({
max: config.cacheSize || 1000,
ttl: 1000,
checkAgeOnGet: true
});
Expand Down

0 comments on commit 8159af8

Please sign in to comment.