Socket
Book a DemoInstallSign in
Socket

cache-manager-memcached-store

Package Overview
Dependencies
Maintainers
2
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cache-manager-memcached-store

memcached impl for cache-manager

latest
Source
npmnpm
Version
6.0.1
Version published
Weekly downloads
5.6K
13.29%
Maintainers
2
Weekly downloads
 
Created
Source

Node Cache Manager store for Memcached

js-standard-style Build Status npm version

The Memcached store for the node-cache-manager

Module can use different compatible memcache clients as the underlying memcache library:

Installation

Install one of the memcached clients from above and cache-manager-memcached-store

npm i memcache-pp --save
npm i cache-manager-memcached-store --save

Acknowledgements

Some of the project scaffolding and test/comments are lifted from node-cache-manager-redis

Till version 3.0.0 cache-manager-memcached-store uses memcache-plus as the underlying memcached library. Newer versions allow to choose any compatible library by passing it's constructor in a driver option. See example below.

Usage examples

const Memcache = require('memcache-pp')
const cacheManager = require('cache-manager')
const memcachedStore = require('cache-manager-memcached-store')

const memcachedCache = cacheManager.caching({
    store: memcachedStore,
    driver: Memcache,
    // http://memcache-plus.com/initialization.html - see options
    options: {
        hosts: ['127.0.0.1:11211']
    } 
})

const ttl = 30

// Compression must be manually set - see memcached-plus documentation
// The key must always be a string
// http://memcache-plus.com/set.html
memcachedCache.set('foo', 'bar', ttl, function(err) {
  if (err) {
    throw err
  }
    
  // http://memcache-plus.com/get.html
  memcachedCache.get('foo', function(err, result) {
      console.log(result)
      // >> 'bar'
      memcachedCache.del('foo', function(err) {})
  })
})

Keywords

cache

FAQs

Package last updated on 28 Dec 2023

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.