
Product
Introducing Socket Firewall: Free, Proactive Protection for Your Software Supply Chain
Socket Firewall is a free tool that blocks malicious packages at install time, giving developers proactive protection against rising supply chain attacks.
This is a variant of Clock cache algorithm that keeps a ghost copy for an extended period of time. It could be useful for implementing shared session cache.
$ npm install hl-cache
new HLCache([options])
Create a cache pool.var cache = new HLCache({
// maximum size of the cache
max: 2000,
// cache entry time-to-live in milliseconds
lifespan: 2000
});
If the number of items in the cache pool exceeds max
, the item will not be store in the cache.
HLCache::get(key[, timestamp])
Get the value by key
. timestamp
is optional, it is used to indicate the time the visit comes from. If no value is provided, timestamp
is set to Date.now()
.
HLCache::set(key, value[, timestamp])
Set the value of key
to value
. timestamp
is optional, it is used to indicate the time the visit comes from. If no value is provided, timestamp
is set to Date.now()
.
HLCache::has(key)
Check if a key is in the cache.
length
Return total length of objects in cache.
This package use Map
and es6-map to polyfill Map
on old version of Node.
es6-map is install as optionalDependencies
. The dependencies section of your application's package.json
file must contain es6-map in order for the polyfill to work.
$ npm test
Half-life cache could (almost) guarantees consistent read in cache’s lifespan, which could be useful for implementing shared session cache.
Copyright (c) 2015 Jingwei "John" Liu
Licensed under the MIT license.
FAQs
A variant of clock cache for implementing shared session cache.
We found that hl-cache 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.
Product
Socket Firewall is a free tool that blocks malicious packages at install time, giving developers proactive protection against rising supply chain attacks.
Research
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.
Research
A malicious package uses a QR code as steganography in an innovative technique.