Security News
Node.js EOL Versions CVE Dubbed the "Worst CVE of the Year" by Security Experts
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
memcache-client-memoizer
Advanced tools
A function memoizer using memcache-client.
Install:
npm i memcache-client-memoizer
Rejected promises and callbacks called with an err
argument are not memoized, since that's a pretty bad idea :)
memoizer(options)
options
: object
. Required. An object with the following keys:
client
: memcache-client instance
. Required. A memcache-client instance.fn
: Function
. Required. The function to memoize, must return a Promise.keyFn
: (args to fn) => 'key-string'
. Required. A function which returns a string cache-key for memcached. This
function is called with the same arguments as fn
, allowing you to create a dynamic cache-key, for example: const exampleKeyFn = ({ name, color }) => `${name}:${color}`
const MemcacheClient = require('memcache-client')
const memoizer = require('memcache-client-memoizer')
const client = new MemcacheClient({ server: 'localhost:11211' })
const fnToMemoize = ({ name, color }) => Promise.resolve(input)
const memoizedFn = memoizer({
client,
fn: fnToMemoize,
keyFn: ({ name, color }) => `${name}:${color}`
})
memoizedFn({name: 'Max', color: 'blue'})
.then((result) => { ... }) // cache miss, fill cache, returns {name: 'Max', color: 'blue'}
// later on...
memoizedFn({name: 'Max', color: 'blue'})
.then((result) => { ... }) // cache hit, returns {name: 'Max', color: 'blue'}
FAQs
Memoizes promise-returning functions via memcache-client
The npm package memcache-client-memoizer receives a total of 13 weekly downloads. As such, memcache-client-memoizer popularity was classified as not popular.
We found that memcache-client-memoizer demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
Security News
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.