Valkey: Configuring Valkey as a cache system for Ruby on Rails
This documentation is part of the Using with Ruby guide. You can view the complete guide here: How to connect Valkey with Ruby.
👋 Welcome to the Stackhero documentation!
Stackhero offers a ready-to-use Valkey cloud solution that delivers numerous advantages, including:
Valkey Adminweb UI included.- Unlimited message size and transfers.
- One-click updates for easy maintenance.
- Optimal performance and enhanced security thanks to a private, dedicated infrastructure.
Save time and make your life easier: it only takes 5 minutes to try Stackhero's Valkey cloud hosting solution!
To configure Valkey as a cache system in Ruby on Rails, follow these steps:
- Install the
redisgem:
bundle add redis
- Edit the
config/environments/production.rbfile and add the following configuration:
config.cache_store = :redis_cache_store, { url: ENV['VALKEY_URL'] }
- Set the
VALKEY_URLenvironment variable. Use a URL in the following format, replacing<yourPassword>and<XXXXXX>with your credentials:
VALKEY_URL="rediss://default:<yourPassword>@<XXXXXX>.stackhero-network.com:<PORT_TLS>"
For more details about configuring Valkey as a cache system for Ruby on Rails, you can refer to the official Rails documentation here.