Gathering detailed insights and metrics for @feathers-plus/cache
Gathering detailed insights and metrics for @feathers-plus/cache
Gathering detailed insights and metrics for @feathers-plus/cache
Gathering detailed insights and metrics for @feathers-plus/cache
LRU (least recently used) cache. Compatible with feathers-hooks-common cache hooks and BatchLoader.
npm install @feathers-plus/cache
Typescript
Module System
Min. Node Version
Node Version
NPM Version
JavaScript (100%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
4 Stars
13 Commits
2 Watchers
2 Branches
4 Contributors
Updated on Jan 28, 2023
Latest Version
1.4.0
Package Id
@feathers-plus/cache@1.4.0
Size
3.10 kB
NPM Version
5.5.1
Node Version
8.6.0
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
1
5
LRU (least recently used) cache for @feathers-plus/batch-loader and @feathers-plus/feathers-hooks-common cache hook.
npm install @feathers-plus/cache --save
@feathers-plus/batch-loader, by default, uses the standard Map which simply grows until the BatchLoader is released. The default is appropriate when requests to your application are short-lived.
Longer lived BatchLoaders, such as ones which persist between @feathers-plus/feathers-hooks-common fastJoin hook queries, will build up memory pressure unless the size of the cache is controlled. Furthermore, if records mutate, their cache entries must be removed.
This BatchLoader-compatible cache implements a LRU (least recently used) cache, it deletes the least recently used items when the cache size is exceeded.
1const BatchLoader = require('@feathers-plus/batch-loader'); 2const feathersCache = require('@feathers-plus/cache'); 3 4const cacheMap = feathersCache({ max: 3 }); // see options in isaacs/node-lru-cache 5const batchLoader = new BatchLoader(batchLoadFn, { cacheMap }); 6 7Promise.all( 8 ['a', 'b', 'c', 'd', 'e'].map(key => batchLoader.load(key)) 9) 10 .then(data => { 11 console.log(data); // [{ key: 'a', data: 'a' }, ..., { key: 'e', data: 'e' }] 12 console.log(cacheMap.keys().sort()); // ['c', 'd', 'e'] 13 }); 14 15// record with key 'd' has been mutated 16batchLoader.clear('d'); 17console.log(cacheMap.keys().sort()); // ['c', 'e'] 18 19function batchLoadFn (keys) { 20 return Promise.all( 21 keys.map(key => ({ key, data: key })) 22 ); 23}
lib/hooks
contains hooks to clear the keys of mutated records.
Copyright (c) 2017
Licensed under the MIT license.
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
project is archived
Details
Reason
Found 0/12 approved changesets -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
39 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-07-07
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More