This add-on is operated by Sidebored.io,Inc.
Boost Heroku with Cache To Go: Easy Redis caching & support.
Cache To Go
Last updated February 01, 2024
The Cache To Go add-on is currently in beta.
Table of Contents
Cache To Go is a powerful Redis service designed for Heroku applications. It offers fast, reliable, and easy-to-integrate caching and storage solutions to improve the performance and scalability of your applications.
Features
- High Performance: Leveraging Redis, Cache To Go delivers high-speed data access.
- Easy Integration: Seamlessly integrates with Heroku apps.
- Scalability: Scales with your application’s needs.
- Data Security: Ensures data is secure and private.
- Monitoring and Metrics: Comprehensive insights into usage and performance.
Provisioning the Add-On
Add Cache To Go to your application via the CLI:
Reference the Cache To Go Elements Page for a list of available plans and regions.
heroku addons:create cachetogo --app example-app
Local Setup
Environment Setup
After provisioning the add-on, replicate its config vars locally for development environments that need the service.
Use the local
Heroku CLI command to configure, run, and manage process types specified in your app’s Procfile. Heroku Local reads configuration variables from a .env
file. Use heroku config
to view an app’s configuration variables in a terminal. Use the following command to add a configuration variable to a local .env
file:
$ heroku config:get cachetogo -s >> .env
Don’t commit credentials and other sensitive configuration variables to source control. In Git exclude the .env
file with: echo .env >> .gitignore
.
For more information, see the Heroku Local article.
Configuring Your Application
After provisioning, Cache To Go sets the CACHETOGO_URL
environment variable. Use this variable to configure your application:
Using Redis from Ruby
require 'redis'
if ENV['CACHETOGO_URL']
$redis = Redis.new(url: ENV['CACHETOGO_URL'])
end
Using Redis from Java
For Java applications, use the following method to integrate Cache To Go:
import redis.clients.jedis.Jedis;
public class RedisExample {
public static void main(String[] args) {
String redisUrl = System.getenv("CACHETOGO_URL");
Jedis jedis = new Jedis(redisUrl);
// Your code here
}
}
Using Redis from Python
In Python, you can integrate Cache To Go like this:
import os
import redis
redis_url = os.getenv('CACHETOGO_URL')
redis_client = redis.Redis.from_url(redis_url)
# Your code here
Using Redis from Node.js
For integrating Cache To Go in a Node.js application, use the following example:
const redis = require('redis');
const client = redis.createClient(process.env.CACHETOGO_URL);
client.on('connect', function() {
console.log('Connected to Redis');
});
// Your code here
Using Redis from PHP
To integrate Cache To Go with a PHP application:
<?php
if (getenv('CACHETOGO_URL')) {
$redis = new Redis();
$redis->connect(getenv('CACHETOGO_URL'));
// Your code here
}
?>
Using Redis from Go:
package main
import (
"github.com/go-redis/redis"
"os"
)
func main() {
redisURL := os.Getenv("CACHETOGO_URL")
opt, err := redis.ParseURL(redisURL)
if err != nil {
panic(err)
}
client := redis.NewClient(opt)
// Your code here
}
These snippets provide a basic guide for integrating Cache To Go into various applications. Be sure to include additional details specific to your add-on’s capabilities and configurations.
Migrating Between Plans
Application owners must carefully manage the migration timing to ensure proper application function during the migration process.
Use the heroku addons:upgrade
command to migrate to a new plan.
heroku addons:upgrade cachetogo:new-plan
Removing the Add-On
Exporting Your Data Before Removal
Before removing the add-on, it’s important to ensure that your data is safe and retrievable. Cache To Go offers a manual process for data export:
Email the support team at support@cachetogo.com with the subject line “Data Export Request”.
Include your account and add-on details in the email.
Cache To Go’s support team processes your request and provides you with a link to download your data.
Remove Cache To Go from your application:
This action destroys all associated data and you can’t undo it!
heroku addons:destroy cachetogo
Support
Contact our support team for any questions or issues at support@cachetogo.com.