Security News
Introducing the Socket Python SDK
The initial version of the Socket Python SDK is now on PyPI, enabling developers to more easily interact with the Socket REST API in Python projects.
@prrashi/lru-diskcache
Advanced tools
A disk cache object that deletes the least-recently-used items.
A disk cache object that deletes the least-recently-used items. Based on lru-cache.
var LRU = require("lru-diskcache")
var cache = LRU('./cache', {
max: 50
});
cache.init()
cache.set("myfile.md", "A string content")
cache.get("file").then(function() { ... }) // Buffer("A string content")
// with a buffer or stream
cache.set("image.png", new Buffer([ ... ]))
cache.set("index.html", request.get("https://www.google.fr"))
cache.reset() // empty the cache
If you put more stuff in it, then items will fall out.
If you try to put an oversized thing in it, then it'll fall out right away.
// Initialize the cache
cache.init()
// Get content as a buffer (return a promise)
cache.get(key)
// Get content as a string
cache.get(key, { encoding: 'utf8' })
// Get content as a stream (return a promise)
cache.getStream(key)
// Check if a key is in the cache, without updating the recent-ness or deleting it for being stale.
cache.has(key)
// Delete a key from the cache
cache.del(key)
// Return total length of objects in cache taking into account
cache.size()
// Manually iterates over the entire cache proactively pruning old entries
cache.prune()
FAQs
A disk cache object that deletes the least-recently-used items.
The npm package @prrashi/lru-diskcache receives a total of 1 weekly downloads. As such, @prrashi/lru-diskcache popularity was classified as not popular.
We found that @prrashi/lru-diskcache 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
The initial version of the Socket Python SDK is now on PyPI, enabling developers to more easily interact with the Socket REST API in Python projects.
Security News
Floating dependency ranges in npm can introduce instability and security risks into your project by allowing unverified or incompatible versions to be installed automatically, leading to unpredictable behavior and potential conflicts.
Security News
A new Rust RFC proposes "Trusted Publishing" for Crates.io, introducing short-lived access tokens via OIDC to improve security and reduce risks associated with long-lived API tokens.