• Docs
  • Changelog
Sign in
Get started
    • Home
    • Your first deploy
    • Free instances
    • Platform features by plan
    • Use with coding agents
    • FAQ
    • Templates
      • Migrate from…
        • Heroku
        • Railway
    • Compute plans
    • SandboxesBeta
      • Service types
        • Which to use?
        • Static sites
        • Web services
        • Private services
        • Background workers
        • Cron jobs
        • Workflows
        • Multi-service architectures
      • Data storage
        • Render Postgres
        • Render Key Value (Redis®-compatible)
        • Persistent disks
    • How deploys work
    • Supported languages
    • Git providers (GitHub, etc.)
    • Build pipeline
    • Deploy hooks
    • Monorepo support
    • Troubleshooting deploys
      • Previewing changes
        • Single-service previews
        • Preview environments (multi-service)
      • Docker deploys
        • Overview
        • Deploy a registered image
        • Using secrets
      • Runtime
        • Native runtimes
        • Environment variables & secrets
        • Default environment variables
    • Intro to sandboxes
    • Limits
      • How to…
        • Create & configure sandboxes
        • Execute commands
        • Manage files
        • Manage snapshots
      • Use with…
        • Claude Managed Agents
        • Cursor Cloud Agents
        • OpenAI Agents API
      • SDK/CLI reference
        • TypeScript SDK
        • Python SDK
        • CLI commands
    • Intro to workflows
    • Tutorial
    • Limits & pricing
      • How to…
        • Define tasks
        • Define flowsNew
        • Trigger runs
        • Develop locally
      • SDK reference
        • TypeScript SDK
        • Python SDK
      • Example workflows
        • TypeScript examples
        • Python examples
    • Overview
    • Create & connect
    • Database credentials
    • Extensions
    • Version upgrades
    • Logical replication
    • Legacy instance types
      • Database recovery
        • Recovery & backups
        • High availability
      • Database performance
        • Read replicas
        • Connection pooling
        • Admin apps
        • Repacking tables
        • Troubleshooting performance
    • Regions
    • Inbound IP rules
    • Edge caching
    • WebSockets
    • TLS certificates
      • Custom domains
        • Overview
        • Cloudflare
        • Namecheap
        • Other DNS providers
      • Internal traffic
        • Private network
        • Private links
      • Outbound traffic
        • Default IP ranges
        • Dedicated IP addresses
        • Outbound bandwidth
        • Handling network changes
      • Static site config
        • Custom response headers
        • Redirects & rewrites
    • The Render Dashboard
    • SSH / Shell access
    • Projects & environments
      • Service actions
        • Scaling
        • Rollbacks
        • Maintenance mode
        • One-off jobs
      • Infrastructure as code
        • Blueprints overview
        • render.yaml reference
        • Terraform provider
    • In-dashboard metrics
    • Health checks
    • Uptime best practices
      • Logging
        • In-dashboard logs
        • Log streams (syslog/HTTPS)
      • OpenTelemetry (OTel) metrics
        • Provider setup
        • Metrics reference
      • Notifications
        • Webhooks
        • Email / Slack
    • MCP Server
      • Render CLI
        • Overview
        • Command reference
      • REST API
        • Overview
        • API reference
      • Third-party connections
        • OIDC support
        • Datadog
    • Workspaces, members, & roles
    • Login settings
    • Audit logs
      • Organizations
        • Overview
        • SAML SSO
    • DDoS protection
    • Platform maintenance
      • Compliance
        • Overview
        • HIPAA (US health data)
        • HIPAA best practices
        • Shared responsibility model
        • Pentest policy
    • Heroku vs Render
    • Vercel vs Render

Rails caching with Redis

This guide will show how you can set up caching using Redis with an existing Rails app on Render. Caching is a technique that allows you to reuse a previous result from a computation or call to speed up the latency of most uses. For example, if you're making requests against an external API and you can tolerate stale results, you can cache the result - reducing the amount of time to retrieve the data from hundreds of milliseconds to just a couple of milliseconds.

Rails gives you the ability to use different cache stores. While MemoryStore and FileStore can be sufficient in many use cases, using an external component for your cache like Redis has a couple of advantages:

  • Redis allows all you to share data between processes and instances. This is especially handy when you're using a threaded server like Puma or if you have multiple server instances.
  • Redis is more persistent. On new deploys, new instances of your web service will be able to access cached results from your old instances.

The rest of the guide assumes you already have an existing Rails app. Follow our Rails quickstart to create one if you don't.

Deploy to Render

We will first deploy a Redis instance on Render that is connected to your Rails app. There are 2 ways to deploy, either by declaring your services within your repository in a render.yaml file, or by manually setting up your services using the dashboard.

Use render.yaml to deploy

In your existing render.yaml , add the following:

This will create a new free Redis instance called cache with a maxmemory-policy set to allkeys-lfu. It also provides the connection string of the Redis instance to the Rails app as an environment variable called REDIS_URL.

Deploy Manually

If you don't want to deploy your Rails app through a Blueprint, you can follow these steps for a manual deploy.

  1. Create a new Redis instance on Render. Note your Redis Internal Redis URL; you will need it later.

  2. Navigate to your Rails app service page. Select the Environment tab. Add the following environment variable:

    KeyValue
    REDIS_URLThe Internal Redis URL for the Redis you created above

Add RedisCacheStore to your Rails app

Now that you've deployed a Redis instance that is connected to your Rails app, we will configure the cache store used in production to be RedisCacheStore with the correct connection url.

  1. Add the following lines to your Gemfile. You may already have the redis gem installed.

  2. Edit the following lines in config/environments/production.rb:

  3. Commit all changes and push them to your GitHub repository.

That's it! Render will redeploy the Rails app so that Rails will use the Redis instance created as its cache store. The official Caching with Rails guide is a great resource to check out next to figure out how to make the most use of your new Redis cache!

Rails caching with Redis
  • Deploy to Render
    • Use render.yaml to deploy
    • Deploy Manually
  • Add RedisCacheStore to your Rails app
All Systems Operational
© Render Inc. All rights reserved.