
Research
Malicious npm Packages Impersonate Flashbots SDKs, Targeting Ethereum Wallet Credentials
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
docvy-cache
Advanced tools
An in-memory cache capable of being swapped from and to disk. For Node.js applications.
// the module returns a Cache constructor
var Cache = require("docvy-cache");
// also this returns a Cache constructor
var CacheConstructor = Cache.Cache;
// create a new cache
var cache = new Cache({
maxAge: 1209600000, // in milliseconds
cacheDir: __dirname + "/cache", // where to swap from/to disk
waitForRestore: true // wait for restoration to complete before any query
});
/**
* All these operations are asynchronous. You might need to structure
* your calls to the cache better
*/
// restore cache
cache.restore(function(err) {
if (err) { return console.log("could not RESTORE"); }
return console.log("RESTORED");
});
// setting an item
cache.set("appName", "docvy-app", function(err) {
if (err) { return console.log("could not SET"); }
return console.log("SET");
});
// getting the item
cache.get("appName", function(err, val) {
if (err) { return console.log("could not GET"); }
return console.log("GOT: " + val);
});
// removing the item
cache.unset("appName", function(err) {
if (err) { return console.log("could not UNSET"); }
return console.log("UNSET");
});
// saving cache
cache.save(function(err) {
if (err) { return console.log("could not SAVE"); }
return console.log("SAVED");
});
// refreshing cache incase we had old items
cache.refresh(function(err) {
if (err) { return console.log("could not REFRESH"); }
return console.log("REFRESHED");
});
// we no longer need the cache?
cache.destroy(function(err) {
if (err) { return console.log("could not DESTROY"); }
return console.log("DESTROYED");
});
This is the constructor for a Cache.
options
(Object):
cacheDir
(String): path to a directory where cache items can be saved tomaxAge
(Number): maximum amount of time to keep an item, in millisecondswaitForRestore
(Boolean): whether to wait for cache to be restored before executing any queries.Restores the cache from its directory, as specified in cacheDir
during instantiation.
done
(Function): other than a possible error is passed to the callback.In case you had already saved a cache, you can restore it.
Saves the cache to its directory.
done
(Function): other than a possible error is passed to the callback.Sets an Item
key
(String): key of the itemvalue
(String): value of the itemoptions
(Object):
maxAge
: a custom maxAge
for this item. NOTE: this value is ignored for items already set into cache. It is only respected if its a new item being set.done
(Function): function called once query is complete. Other than a possible error is passed to the callback.Returns value of item.
key
(String): key of the itemcallback
(Function): function passed the value of item.
callback(err, value)
Removes an item from cache.
key
(String): key of the itemdone
(Function): function called once query is complete. Other than a possible error is passed.Refreshes cache by removing expired items. All keys are checked to ensure they have not lived past their expiry time.
done
(Function): called once cache refreshing is complete. Other than a possible error is passed.Destroys the entire cache both from in-memory and file-system.
done
(Function): function called once destroying cache is complete. Other than a possible error is passed.(Bleeding Edge) Installing from github using npm:
⇒ npm install docvy-cache
cache.refresh
cache.destroy
The MIT License (MIT)
Copyright (c) 2015 Forfuture we@forfuture.co.ke
Copyright (c) 2015 GochoMugo mugo@forfuture.co.ke
FAQs
The Docvy Cache
The npm package docvy-cache receives a total of 0 weekly downloads. As such, docvy-cache popularity was classified as not popular.
We found that docvy-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
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
Security News
Ruby maintainers from Bundler and rbenv teams are building rv to bring Python uv's speed and unified tooling approach to Ruby development.
Security News
Following last week’s supply chain attack, Nx published findings on the GitHub Actions exploit and moved npm publishing to Trusted Publishers.