Socket
Socket
Sign inDemoInstall

memcached

Package Overview
Dependencies
Maintainers
1
Versions
33
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

memcached

A fully featured Memcached API client, supporting both single and clustered Memcached servers through consistent hashing and failover/failure. Memcached is rewrite of nMemcached, which will be deprecated in the near future.


Version published
Maintainers
1
Created

What is memcached?

The memcached npm package is a client for interacting with a Memcached server, which is a high-performance, distributed memory object caching system. It is used to speed up dynamic web applications by alleviating database load.

What are memcached's main functionalities?

Connecting to a Memcached server

This code demonstrates how to establish a connection to a Memcached server running on localhost at the default port 11211.

const Memcached = require('memcached');
const memcached = new Memcached('localhost:11211');

Storing a value

This code sample shows how to store a value in the Memcached server with a key and an expiration time of 10 seconds.

memcached.set('key', 'value', 10, function (err) { 
  if (err) console.error(err); 
});

Retrieving a value

This code demonstrates how to retrieve a value from the Memcached server using a key.

memcached.get('key', function (err, data) { 
  if (err) console.error(err); 
  console.log(data); 
});

Deleting a value

This code sample shows how to delete a value from the Memcached server using a key.

memcached.del('key', function (err) { 
  if (err) console.error(err); 
});

Incrementing a value

This code demonstrates how to increment a numeric value stored in the Memcached server.

memcached.increment('counter', 1, function (err, result) { 
  if (err) console.error(err); 
  console.log(result); 
});

Decrementing a value

This code sample shows how to decrement a numeric value stored in the Memcached server.

memcached.decrement('counter', 1, function (err, result) { 
  if (err) console.error(err); 
  console.log(result); 
});

Other packages similar to memcached

Keywords

FAQs

Package last updated on 03 Oct 2012

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