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.
@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
const 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
const obj1 = await keyv1.get("foo"); //will return bar1
const obj2 = await keyv2.get("foo"); //will return bar2
//set the server to the correct address and port
const server = "localhost:11211"
const Keyv = require("keyv");
const KeyvMemcache = require("@keyv/memcache");
const memcache = new KeyvMemcache(server);
const keyv = new Keyv({ store: memcache});
//best practice is to not hard code your config in code.
const user = "";
const pass = "";
const 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.
const user = "";
const pass = "";
const 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
The npm package @keyv/memcache receives a total of 81,003 weekly downloads. As such, @keyv/memcache popularity was classified as popular.
We found that @keyv/memcache demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers 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.