
Security News
GitHub Actions Supply Chain Attack Puts Thousands of Projects at Risk
A compromised GitHub Action exposed secrets in CI/CD logs, putting thousands of projects at risk and forcing developers to urgently secure their workflows.
keyv-memcache
Advanced tools
Memcache storage adapter for Keyv
npm install --save keyv-memcache
or
yarn add keyv-memcache
const Keyv = require('keyv');
const KeyvMemcache = require('keyv-memcache');
const memcache = new KeyvMemcache('user:pass@localhost:11211');
const keyv = new Keyv({ store: memcache });
//set
await keyv.set("foo","bar", 6000) //Expiring time is optional
//get
let obj = await keyv.get("foo");
//delete
await keyv.delete("foo");
//clear
await keyv.clear();
const Keyv = require('keyv');
const KeyvMemcache = require('keyv-memcache');
const memcache = new KeyvMemcache('user:pass@localhost:11211');
const keyv1 = new Keyv({ store: memcache, namespace: "namespace1" });
const keyv2 = new Keyv({ store: memcache, namespace: "namespace2" });
//set
await keyv1.set("foo","bar1", 6000) //Expiring time is optional
await keyv2.set("foo","bar2", 6000) //Expiring time is optional
//get
let obj1 = await keyv1.get("foo"); //will return bar1
let obj2 = await keyv2.get("foo"); //will return bar2
//set the server to the correct address and port
let server = "localhost:11211"
const Keyv = require("keyv");
const KeyvMemcache = require("keyv-memcache");
const memcache = new KeyvMemcache();
const keyv = new Keyv({ store: memcache});
//best practice is to not hard code your config in code.
let user = "";
let pass = "";
let server = "XXX.XXX.XXX.memcachier.com:11211"
const Keyv = require("keyv");
const KeyvMemcache = require("keyv-memcache");
const memcache = new KeyvMemcache(user +":"+ pass +"@"+ server);
const keyv = new Keyv({ store: memcache});
Protocol
to memcachedendpoint
(the server) and place it into your code:
//best practice is to not hard code your config in code.
let user = "";
let pass = "";
let server = "XXX.XXX.XXX.XXX.cloud.redislabs.com:XXX"
const Keyv = require("keyv");
const KeyvMemcache = require("keyv-memcache");
const memcache = new KeyvMemcache(user +":"+ pass +"@"+ server);
const keyv = new Keyv({ store: memcache});
const Keyv = require("keyv");
const KeyvMemcache = require("keyv-memcache");
const memcache = new KeyvMemcache("insert the internal google memcached discovery endpoint");
const keyv = new Keyv({ store: memcache});
MIT © Jared Wray
FAQs
Memcache storage adapter for Keyv
We found that keyv-memcache 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
A compromised GitHub Action exposed secrets in CI/CD logs, putting thousands of projects at risk and forcing developers to urgently secure their workflows.
Research
Security News
A malicious Maven package typosquatting a popular library is secretly stealing OAuth credentials on the 15th of each month, putting Java developers at risk.
Security News
Socket and Seal Security collaborate to fix a critical npm overrides bug, resolving a three-year security issue in the JavaScript ecosystem's most popular package manager.