High Leverage Rails
Introduction
Introduction to this course
Why use Ruby on Rails
Why use SQLite
Ruby on Rails + SQLite
Powering Your App with SQLite
Creating tables
Timestamps
Column types
Typeof
Ruby types
Creating table introduction
Creating table advanced
Inserting data
Updating data
Upserting data
Reading data
Virtual columns
Enums
Introduction to JSON
Indexing JSON
JSON table functions
Building a Modern Rails Application
Creating a new Rails application
Installing Solid Queue
Installing Solid Cache
Installing Solid Cable
Dockerfile
Application overview
Authentication
Base styles
Registration
Scaffolding posts
Polishing posts
Scaffolding comments
Polishing comments
Polishing models
Polishing controllers
Creating new post
Updating post
Reviewing MVP
Tagging posts
Custom tags
Friendly URLs
Full text search
Deploying & Operating Your App
Backups
Check Litestream locally
Verifying backups
Deployment options
Deploying with Hatchbox
Deployment constraints
Vertical scaling
Database access
Migrations
Locked video

Please purchase the course to watch this video.

Video thumbnail
Building a Modern Rails Application
Installing Solid Cache

Full Course

$
129
$179
USD, one-time fee
This course came at the perfect time. I’ve recently gotten back into Rails after an 18-year hiatus, and this was a perfect refresher and shows just how much you can accomplish with Rails right out of the box.
Garrett Winder
Garrett Winder

Move fast and fix things

Application monitoring that helps developers get it done.

Rails hosting made simple

Deploy apps to servers that you own and control.

Summary

Learn how Rails 8’s Solid Cache enhances database-backed caching with built-in encryption, sharding, and GDPR-compliant data retention policies. Discover how it offers secure, persistent storage, making it a powerful alternative to Redis for privacy-sensitive applications.

Links

Solid Cache Documentation

Video Transcript

Next up, let’s take a look at Solid Cache, the sibling to Solid Queue and one of the three Solid gems that are now default in Rails 8.

What is Solid Cache?

As you might expect, Solid Cache powers the caching system in Rails applications.

Looking at the schema file, we see that Solid Cache has a much simpler structure compared to Solid Queue—it consists of just one table where all cache entries are stored. While the architectural decisions behind Solid Cache have been discussed in conference talks, for now, let’s focus on how it’s configured and used.

Configuring Solid Cache in Rails 8

Opening config/cache.yml, we see the default cache settings:

  • Max Cache Size → 256MB.
  • Namespace Mapping → Matches the current environment (development, production, test, etc.).
  • Database Storage → In production, Solid Cache uses a dedicated database file.

This brings us back to database.yml, where Rails automatically separates each component into its own SQLite database:

  1. Primary Database → Stores application models.
  2. Queue Database → Handles background jobs.
  3. Cache Database → Manages cached data.
  4. ActionCable Database → Handles WebSocket messages.

This separation improves performance and concurrency, ensuring cache operations don’t interfere with database writes or job processing.

How Solid Cache Works in Development vs. Production

There is a key difference in how caching works between development and production:

  • Production → Uses the Solid Cache database adapter for persistent caching.
  • Development → Uses in-memory caching by default (no persistence).

This means that in development:

  • Jobs and cache entries exist only in memory.
  • They disappear when the process stops.
  • It’s fast and requires no setup.

However, if you want to use Solid Cache in development, you can manually enable it by following setup scripts.

Key Features of Solid Cache

Solid Cache provides several powerful features that make it a robust alternative to Redis or Memcached:

  • Encrypted Cache Entries → Rails’ built-in encryption support ensures cache data is encrypted at rest and in transit. This is critical for privacy-sensitive applications like email services or social platforms.
  • Database Sharding → Allows cache data to be distributed across multiple databases for scalability. While we’ll start with a single cache database, this feature makes horizontal scaling easy. 37signals uses this approach to shard cache across multiple large databases in Basecamp.
  • Data Retention Policies → You can set a Max Age for cached data. This helps meet compliance regulations like GDPR, ensuring sensitive data is purged after a set period (e.g., 60 days).

Why Solid Cache is an Exciting Default for Rails 8

I’m excited that Solid Cache is now a Rails default because it:

  • Removes the need for third-party caching solutions (like Redis).
  • Works seamlessly with Rails’ encryption and sharding features.
  • Provides a production-ready caching system with zero extra setup.

With Solid Queue handling background jobs and Solid Cache managing fast, secure storage, Rails 8 is making it easier than ever to build scalable, production-grade applications.

In the next video, we’ll look at Solid Cable, which powers WebSocket messaging.