Docs

Ruby

redis-rb, the Rails cache and Sidekiq.

Each example reads the connection URL from VALKEY_URL; copy it from your instance page in the dashboard. See connection details and limits for what applies to every client.

On this page: redis-rb · Rails cache · Sidekiq

redis-rb

The redis gem turns on TLS for rediss:// URLs.

Install
bundle add redis
app.rb
require "redis" redis = Redis.new(url: ENV.fetch("VALKEY_URL")) redis.set("greeting", "hello", ex: 60)puts redis.get("greeting")

Rails cache

Use the built-in Redis cache store. It needs the redis gem.

Install
bundle add redis
config/environments/production.rb
config.cache_store = :redis_cache_store, {  url: ENV.fetch("VALKEY_URL"),  namespace: "myapp",  expires_in: 1.hour,}

Sidekiq

Point both the server (workers) and the client (your app) at the same URL.

Install
bundle add sidekiq
config/initializers/sidekiq.rb
Sidekiq.configure_server do |config|  config.redis = { url: ENV.fetch("VALKEY_URL") }end Sidekiq.configure_client do |config|  config.redis = { url: ENV.fetch("VALKEY_URL") }end
Starter evicts keys when memory is full (allkeys-lru), which can silently drop jobs. Use it for experiments; production queues need a persistent plan with noeviction (Casual or Pro, coming soon).

© 2026 KVNest · Managed Redis and Valkey, hosted in the EU

Redis is a registered trademark of Redis Ltd. Any rights therein are reserved to Redis Ltd. KVNest is not affiliated with or endorsed by Redis Ltd.