Skip Navigation
Show nav
Heroku Dev Center Dev Center
  • Get Started
  • Documentation
  • Changelog
  • Search
Heroku Dev Center Dev Center
  • Get Started
    • Node.js
    • Ruby on Rails
    • Ruby
    • Python
    • Java
    • PHP
    • Go
    • Scala
    • Clojure
    • .NET
  • Documentation
  • Changelog
  • More
    Additional Resources
    • Home
    • Elements
    • Products
    • Pricing
    • Careers
    • Help
    • Status
    • Events
    • Podcasts
    • Compliance Center
    Heroku Blog

    Heroku Blog

    Find out what's new with Heroku on our blog.

    Visit Blog
  • Log in or Sign up
View categories

Categories

  • Heroku Architecture
    • Compute (Dynos)
      • Dyno Management
      • Dyno Concepts
      • Dyno Behavior
      • Dyno Reference
      • Dyno Troubleshooting
    • Stacks (operating system images)
    • Networking & DNS
    • Platform Policies
    • Platform Principles
    • Buildpacks
  • Developer Tools
    • Command Line
    • Heroku VS Code Extension
  • Deployment
    • Deploying with Git
    • Deploying with Docker
    • Deployment Integrations
  • Continuous Delivery & Integration (Heroku Flow)
    • Continuous Integration
  • Language Support
    • Node.js
      • Working with Node.js
      • Node.js Behavior in Heroku
      • Troubleshooting Node.js Apps
    • Ruby
      • Rails Support
      • Working with Bundler
      • Working with Ruby
      • Ruby Behavior in Heroku
      • Troubleshooting Ruby Apps
    • Python
      • Working with Python
      • Background Jobs in Python
      • Python Behavior in Heroku
      • Working with Django
    • Java
      • Java Behavior in Heroku
      • Working with Java
      • Working with Maven
      • Working with Spring Boot
      • Troubleshooting Java Apps
    • PHP
      • Working with PHP
      • PHP Behavior in Heroku
    • Go
      • Go Dependency Management
    • Scala
    • Clojure
    • .NET
      • Working with .NET
  • Databases & Data Management
    • Heroku Postgres
      • Postgres Basics
      • Postgres Getting Started
      • Postgres Performance
      • Postgres Data Transfer & Preservation
      • Postgres Availability
      • Postgres Special Topics
      • Migrating to Heroku Postgres
    • Heroku Key-Value Store
    • Apache Kafka on Heroku
    • Other Data Stores
  • AI
    • Model Context Protocol
    • Heroku Inference
      • Inference API
      • Heroku Inference Quick Start Guides
      • Inference Essentials
      • AI Models
    • Vector Database
    • Working with AI
  • Monitoring & Metrics
    • Logging
  • App Performance
  • Add-ons
    • All Add-ons
  • Collaboration
  • Security
    • App Security
    • Identities & Authentication
      • Single Sign-on (SSO)
    • Private Spaces
      • Infrastructure Networking
    • Compliance
  • Heroku Enterprise
    • Enterprise Accounts
    • Enterprise Teams
    • Heroku Connect (Salesforce sync)
      • Heroku Connect Administration
      • Heroku Connect Reference
      • Heroku Connect Troubleshooting
  • Patterns & Best Practices
  • Extending Heroku
    • Platform API
    • App Webhooks
    • Heroku Labs
    • Building Add-ons
      • Add-on Development Tasks
      • Add-on APIs
      • Add-on Guidelines & Requirements
    • Building CLI Plugins
    • Developing Buildpacks
    • Dev Center
  • Accounts & Billing
  • Troubleshooting & Support
  • Integrating with Salesforce
  • Add-ons
  • All Add-ons
  • Memcached Cloud
Memcached Cloud

This add-on is operated by Redis

Enterprise-Class Memcached for Developers

Memcached Cloud

Last updated July 11, 2025

Table of Contents

  • Get started
  • Connect to your database
  • Open Redis Cloud console
  • Upgrade plan
  • Remove the add-on
  • Support

Memcached Cloud (part of Redis Cloud) is a fully managed cloud service for running your Memcached databases. You can quickly and easily get your apps up and running with Memcached Cloud through its add-on for Heroku - tell us how much memory you need and get started fast with your first Memcached database. You can then add more Memcached databases and increase or decrease the memory size of your plan without affecting your existing data.

Memcached Cloud offers true high availability with its in-memory dataset replication and instant auto-failover mechanism. Memcached Cloud provides various data persistence options as well as remote backups for disaster recovery purposes.

Get started

Select Install Memcached Cloud to install the Memcached Cloud add-on.

You can also use the Heroku command-line interface to install Redis Cloud. Run the following heroku command to install the add-on and create a Free 30MB database.

$ heroku addons:create memcachedcloud

You can also specify the plan size by adding the plan size in MB. For example, run the following command to install the add-on and create a 1GB database.

$ heroku addons:create memcachedcloud:1000

A list of all available plans can be found here.

Once Memcached Cloud has been added, you will notice three new config vars in your heroku environment containing the servers, username and password of your first Memcached Cloud bucket: MEMCACHEDCLOUD_SERVERS, MEMCACHEDCLOUD_USERNAME, and MEMCACHEDCLOUD_PASSWORD . Run heroku config to see the config vars.

Connect to your database

You can connect to your database with any Memcached client that supports SASL authentication.

The following sections show how to connect with these languages and frameworks:

  • Ruby with Dalli
  • Java with spymemcached
  • Python with bmemcached
  • PHP with PHP Memcached
  • Node.js with MemJS

Connect with Ruby

Dalli is a high performance, pure Ruby client for accessing Memcached servers that uses binary protocol.

To use Dalli with Rails 3.x, update your gems with:

gem 'dalli'

And then install the gem via Bundler:

bundle install

Lastly, add the following line in your config/environments/production.rb:

if ENV["MEMCACHEDCLOUD_SERVERS"]
    config.cache_store = :mem_cache_store, ENV["MEMCACHEDCLOUD_SERVERS"].split(','), { :username => ENV["MEMCACHEDCLOUD_USERNAME"], :password => ENV["MEMCACHEDCLOUD_PASSWORD"] }
end

Configure Memcached on Sinatra

Add this code snippet to your configure block:

configure do
    . . .
    require 'dalli'

    if ENV["MEMCACHEDCLOUD_SERVERS"]
        $cache = Dalli::Client.new(ENV["MEMCACHEDCLOUD_SERVERS"].split(','), :username => ENV["MEMCACHEDCLOUD_USERNAME"], :password => ENV["MEMCACHEDCLOUD_PASSWORD"])
    end
    . . .
end

Use Memcached on Unicorn

No special setup is required when using Memcached Cloud with a Unicorn server. Users running Sinatra apps on Unicorn should follow the instructions in the Configure Memcached on Sinatra section.

Testing (Ruby)

$cache.set("foo", "bar")
# => true
$cache.get("foo")
# => "bar"

A Sinatra sample application is available at GitHub.

Browse the source code or Deploy

Connect with Java

spymemcached is a simple, asynchronous, single-threaded Memcached client written in Java. You can download the latest build from: https://code.google.com/p/spymemcached/downloads/list. If you are using Maven, start by adding the following repository:

<repositories>
    <repository>
      <id>spy</id>
      <name>Spy Repository</name>
      <layout>default</layout>
      <url>http://files.couchbase.com/maven2/</url>
      <snapshots>
        <enabled>false</enabled>
      </snapshots>
    </repository>
</repositories>

Then, specify the actual artifact as follows:

<dependency>
  <groupId>spy</groupId>
  <artifactId>spymemcached</artifactId>
  <version>2.8.9</version>
  <scope>provided</scope>
</dependency>

Configure the connection to your Memcached Cloud service by using the environment variables as shown in the following code snippet:

try {
    AuthDescriptor ad = new AuthDescriptor(new String[] { "PLAIN" },
        new PlainCallbackHandler(System.getenv("MEMCACHEDCLOUD_USERNAME"), System.getenv("MEMCACHEDCLOUD_PASSWORD")));

    MemcachedClient mc = new MemcachedClient(
              new ConnectionFactoryBuilder()
                  .setProtocol(ConnectionFactoryBuilder.Protocol.BINARY)
                  .setAuthDescriptor(ad).build(),
          AddrUtil.getAddresses(System.getenv("MEMCACHEDCLOUD_SERVERS")));

} catch (IOException ex) {
    // the Memcached client could not be initialized.
}

Testing (Java)

mc.set("foo", 0, "bar");
Object value = mc.get("foo");

A Java sample application, running on Play!, is available at GitHub.
Browse the source code or Deploy

Connect with Python

bmemcached is a pure, thread safe, python module to access memcached via binary protocol.

Use pip to install it:

$ pip install python-binary-memcached

Configure the connection to your Memcached Cloud service using the MEMCACHEDCLOUDconfig vars and the following code snippet:

import os
import urlparse
import bmemcached
import json

mc = bmemcached.Client(os.environ.get('MEMCACHEDCLOUD_SERVERS').split(','), os.environ.get('MEMCACHEDCLOUD_USERNAME'), os.environ.get('MEMCACHEDCLOUD_PASSWORD'))

Testing (Python)

mc.set('foo', 'bar')
print client.get('foo')

Connect with PHP

PHP Memcached ensures efficient performance as well as advanced features on top of the core memcached functions.

Heroku’s PHP environment supports it as a third party extension - just add the following module to your composer.json file:

"require": {
    "ext-memcached": "*"
}

Next, ensure that your new requirements are “frozen” to composer.lock by running:

$ composer update

For more information on enabling the extension and potential troubleshooting (e.g. when you don’t have the memcached extension available on your local computer), refer to the using optional extensions extensions section of Heroku’s PHP reference documentation.

Configure a connection to your Memcached Cloud service using the MEMCACHEDCLOUD config vars and the following code snippet:

$mc = new Memcached();
$mc->setOption(Memcached::OPT_BINARY_PROTOCOL, true);
$mc->addServers(array_map(function($server) { return explode(':', $server, 2); }, explode(',', $_ENV['MEMCACHEDCLOUD_SERVERS'])));
$mc->setSaslAuthData($_ENV['MEMCACHEDCLOUD_USERNAME'], $_ENV['MEMCACHEDCLOUD_PASSWORD']);

Testing (PHP)

$mc->set('foo', 'bar');
echo $mc->get('foo');

A PHP sample application is available at GitHub.
Browse the source code or Deploy

Connect with Node.js

MemJS is a pure Node.js client library for using memcached. It uses the binary protocol and support SASL authentication.

You can install it with:

$ npm install memjs

Configure a connection to your Memcached Cloud service using the following code snippet:

var memjs = require('memjs');

var client = memjs.Client.create(process.env.MEMCACHEDCLOUD_SERVERS, {
  username: process.env.MEMCACHEDCLOUD_USERNAME,
  password: process.env.MEMCACHEDCLOUD_PASSWORD
});

Testing (Node.js)

client.set("foo", "bar");
client.get("foo", function (err, value, key) {
  if (value != null) {
    console.log(value.toString()); // Will print "bar"
  }
});

A Node.js sample application is available at GitHub.
Browse the source code or Deploy

Open Redis Cloud console

The Redis Cloud console lets you make changes to your Memcached database settings, add extra databases to your plan, and view metrics for your databases.

To access the Redis Cloud console and view your Memcached Cloud database, run:

$ heroku addons:open memcachedcloud

Alternatively, open the Memcached Cloud add-on from your application’s dashboard at heroku.com.

From the Redis Cloud console, you can:

  • Back up your data and view backups
  • Add more Memcached databases to your plan
  • View database metrics

Back up your data

By default, Memcached Cloud stores your backups to a default backup repository. To view your backups from the Redis Cloud console, select your database from the database list. In the Configuration tab, under Durability, select View backups.

View backups button

Select Download to download a backup file.

Download backup button

The default repository only retains daily backups for one week. To learn how to change your backup location, see Back up a database (Redis Cloud docs).

Select Backup now to back up your database manually.

Backup now button

Backups are available only for paid plans.

Add Memcached databases to your plan

For paid plans, Memcached Cloud allows you to add multiple Memcached databases without interfering with your other databases from the Redis Cloud console.

Each plan has a limit for the amount of databases you can create. After you reach the database limit or the memory limit for your plan, you won’t be able to add any more databases.

Your first Memcached database is created automatically upon launching the Memcached Cloud add-on and its servers and credentials are maintained in the MEMCACHEDCLOUDconfig vars.

To add more databases from the Redis Cloud console:

  1. Select Subscriptions from the menu to see your plan with all of its databases.
  2. Select + Create database in this subscription.

    Create database in this subscription button

  3. Enter the database name and select your new database’s settings.

  4. Select Activate database to activate your new database.

After your new database is ready, you’re able to connect to it. You can find the public endpoint for your new database in the Configuration tab of your database in the General section. The credentials for your new database are available in the Security section.

View database metrics

To view metrics from the Redis Cloud console, select your database from the database list, and then select the Metrics tab.

Metrics tab with metrics

For more information on the metrics available in the Redis Cloud console, see Monitor database performance (Redis Cloud docs).

Upgrade plan

Upgrading your plan is easy and instant. It requires no code change and has no effect on your existing datasets. You can use the ‘heroku addons:upgrade’ command to upgrade to a new plan.

$ heroku addons:upgrade memcachedcloud:[size_in_mb]

For example, run this command to upgrade to a 5 GB database:

$ heroku addons:upgrade memcachedcloud:5000

Remove the add-on

To remove the Memcached Cloud add-on, run:

This will destroy all data and cannot be reversed.

$ heroku addons:destroy memcachedcloud

Support

All Memcached Cloud support and runtime issues should be submitted via the Heroku Support channels. We recommend also reaching out to Redis support for urgent issues. We are also available on twitter @Redisinc.

Keep reading

  • All Add-ons

Feedback

Log in to submit feedback.

Zara 4 MemCachier

Information & Support

  • Getting Started
  • Documentation
  • Changelog
  • Compliance Center
  • Training & Education
  • Blog
  • Support Channels
  • Status

Language Reference

  • Node.js
  • Ruby
  • Java
  • PHP
  • Python
  • Go
  • Scala
  • Clojure
  • .NET

Other Resources

  • Careers
  • Elements
  • Products
  • Pricing
  • RSS
    • Dev Center Articles
    • Dev Center Changelog
    • Heroku Blog
    • Heroku News Blog
    • Heroku Engineering Blog
  • Twitter
    • Dev Center Articles
    • Dev Center Changelog
    • Heroku
    • Heroku Status
  • Github
  • LinkedIn
  • © 2025 Salesforce, Inc. All rights reserved. Various trademarks held by their respective owners. Salesforce Tower, 415 Mission Street, 3rd Floor, San Francisco, CA 94105, United States
  • heroku.com
  • Legal
  • Terms of Service
  • Privacy Information
  • Responsible Disclosure
  • Trust
  • Contact
  • Cookie Preferences
  • Your Privacy Choices