Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

memcached-mock

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

memcached-mock

A mock implementation of memcached to use as a replacement in tests

  • 0.0.2
  • npm
  • Socket score

Version published
Weekly downloads
4K
increased by0.08%
Maintainers
1
Weekly downloads
 
Created
Source

memcached-mock

A mock implementation of memcached to use as a replacement in tests.

This is currently a work in progresss. This version of the mock supports the following methods:

  • add(key, value, ttl, callback)
  • append(key, value, callback)
  • cas(key, value, cas, ttl, callback)
  • decr(key, amount, callback)
  • del(key, callback)
  • flush(callback)
  • get(key, callback)
  • gets(key, callback)
  • getMulti(keys, callback)
  • incr(key, amount, callback)
  • prepend(key, value, callback)
  • replace(key, value, ttl, callback)
  • set(key, value, ttl, callback)

Example usage:

var Memcached = require('memcached-mock');

var memcached = new Memcached('localhost:11211');

you can then set values like so:

memcached.set("hello", "world!", 60, function(err) {
  // ...
});

and retrieve those same values:

memcached.get("hello", function(err, data) {
  if (!err)
    console.log(data); // prints: world!
});

Although the interface is the same, no network calls are made. Values are stored in memory and discarded when the process exits.

Keywords

FAQs

Package last updated on 25 Feb 2015

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

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc