Edit on GitHub

Memcached Cache Connector

What is Memcached?

Memcached is a distributed caching system. All its data is purely kept in memory which means two things:

  • its very fast
  • everything is gone if you pull the plug.That's not necessarily a bad thing, but it means you need some sort of persistent database layer as well if you choose to go with Memcached.

Why use Memcached with deepstream?

For two reasons: Speed and scale. Memcached can power large clusters and writes and reads data very quickly. The memcached protocol has also seen some wider adoption, e.g. by Hazelcast, so if you do decide to change caches at some point, migration might be quite easy.

I want to use AWS Elasticache with deepstream. Should I choose Memcached or Redis as a caching-engine?

Redis! Memcached is a great cache, but Redis also saves data to disk and can act as a message-bus for smaller deepstream clusters, giving you all the functionality you need.

How to use Memcached with deepstream?

deepstream comes with an official connector for Memcached. You can install it via the commandline:

deepstream install cache memcached

resulting in the following output

Memcached Console Output

If you are using deepstream from Node, you can also install it via NPM

Configuring the Memcached connector

You can configure memcached in the plugin section of deepstream's config.yml file

    name: memcached
      serverLocation: [ 'localhost:11211' ] # One or more endpoint URLs
Need support, architectural consulting or training? Buy Support