Login Try it Free


Last Updated: Jun 13, 2012 12:00PM MDT

Redis is an "open source, advanced key-value store" that makes for an extremely powerful caching mechanism or in-memory database. After reading this guide, you will be familiar with:

  •  Adding a Redis component to your app
  •  Connecting your app to your Redis component

Enable Any Necessary PHP Extensions in Your Boxfile

Depending on how your app is built to communicate with Redis, you may need to add php extensions to your web component. This is done in your Boxfile.

 YAMLEnabling Extensions in Your Boxfile 


If you're wondering what extensions are available, check out the full list of available PHP Extensions.

Creating a Redis Component

Through the App Dashboard

Creating a Redis component through your app dashboard is simple. Start by clicking the "Add Cache" button.

  Add Cache  

Select Redis as your cache type. Select Cloud or Dedicated (Currently we only off cloud instances, but dedicated instances are coming). Then, if you would like, name your Redis component. If you don't name it, it will be assigned a random name. Click "Create" and your Redis component will be created.

From the Boxfile

To create a Redis instance from your Boxfile, simply include following.

 YAMLCreating a Redis Instance from Your Boxfile 


On your next deploy, a Redis instance will be created.

Connecting to Redis

Because applications vary widely in how they connect to Redis, it's hard to give you a generic code example of how to connect to your Redis instance. What is uniform is the need for a Host and Port to connect to. These can be found in your app dashboard.

To get your Redis credentials, click on your cache component in your app dashboard to expand your component details. Click on the "Show Credentials" link in the bottom left of your component details.


Your Host is "tunnel.pagodabox.com" and your port is the number provided at the end. Once these credentials are in the correct location in your source code, you should be good to go.

Tunneling into Redis

Redis components are tunnelable, much like database components. So you can tunnel into them using the Pagoda Gem.

 TerminalTunnel Connection 

With the tunnel open, use the Redis-CLI to connect to and manage your Redis component.

 TerminalConnecting with the Redis-CLI 


Remember, when connecting to your Redis component through the tunnel, use the credentials provided in the tunnel; not the credentials in your app dashboard.

For more details about using Redis, check out the full Redis Documentation.

If you have any suggestions or corrections for this guide, please submit a ticket.

Contact Us