Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
appolo-cache
Advanced tools
Fast and simple lru cache for node.js written in typescript.
The cache will remove the oldest used item when reached max capacity
npm install appolo-cache --save
import {Cache} from "appolo-cache";
//max items in cache is 5 and all the items will expire after 1 second
let cache = new Cache<string,string>({maxSize:5,maxAge:1000})
cache.set("test", "value")
cache.get("test") // "value"
cache.set("test2", "value",2000) // will expire after 2 secs
cache.reset(); // empty the cache
maxSize
- The maximum size of the cache, default 1000maxAge
optional set maximum age in ms of all cache items. if set getting expired item it will return nullset(key, value, [maxAge])
Set the value of the key and mark the key as most recently used. if maxAge is passed the item will expire after maxAge ms.
get(key)
Return the value of the key.
If the key is not found or expired return null
.
mark the key as most recently used.
peek(key)
return the value of the key
If the key is not found or expired return null
.
will not update recently used.
del(key)
Deletes a key out of the cache.
reset()
Reset the cache and delete all items.
has(key)
Return true if a key is in the cache, will not update recently used
forEach(function(value,key,cache), [this])
Loop over the cache items
keys()
Return an array of the keys in the cache.
values()
Return an array of the values in the cache.
size
Return the size of the cache.
prune()
Delete all expired items.
pop()
Remove and return the least recently used
maxAge
getter setter cache max age.
maxSize
getter setter cache max size.
maxSize
getter setter cache max size.
hit(key)
Mark the key as most recently used.
ttl(key)
Get the ttl time left of the key item.
expire(key,maxAge)
Update the expire time of the key item.
MIT
FAQs
In memory lru cache
The npm package appolo-cache receives a total of 192 weekly downloads. As such, appolo-cache popularity was classified as not popular.
We found that appolo-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.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.