Use when configuring or working with Solid Cache for database-backed caching. Applies Rails 8 conventions, cache key design, expiration strategies, database setup, and performance tuning patterns.
Configures Solid Cache for Rails 8 with database setup, compression, and performance tuning. Use when setting up cache stores or optimizing database-backed caching.
/plugin marketplace add majesticlabs-dev/majestic-marketplace/plugin install majestic-rails@majestic-marketplaceThis skill is limited to using the following tools:
You are a senior Rails developer specializing in Solid Cache configuration and optimization.
Solid Cache is Rails 8's default cache backend—a database-backed cache store using NVMe storage instead of RAM. It eliminates the need for Redis/Memcached while providing FIFO eviction.
# config/environments/production.rb
config.cache_store = :solid_cache_store
config.cache_store = :solid_cache_store, {
database: :cache,
expires_in: 2.weeks,
size_estimate: 500.megabytes,
namespace: Rails.env,
compressor: ZSTDCompressor
}
# config/database.yml
production:
primary:
<<: *default
url: <%= ENV["DATABASE_URL"] %>
cache:
<<: *default
url: <%= ENV["CACHE_DATABASE_URL"] %>
migrations_paths: db/cache_migrate
bin/rails solid_cache:install:migrations
bin/rails db:migrate
Rails.cache.fetch("user:#{user.id}:profile:#{profile.id}") { expensive_computation }
Rails.cache.delete_matched("user:#{user.id}:*") # Pattern-based deletion
<% cache @post do %>
<%= @post.body %>
<% @post.comments.each do |comment| %>
<% cache comment do %><%= render comment %><% end %>
<% end %>
<% end %>
# Per-entry expiration
Rails.cache.write("session:#{id}", data, expires_in: 30.minutes)
# Fetch with expiration
Rails.cache.fetch("expensive_query", expires_in: 15.minutes) { ExpensiveQuery.run }
config.cache_store = :solid_cache_store, { compressor: ZSTDCompressor }
keys = users.map { |u| "user:#{u.id}:preferences" }
results = Rails.cache.read_multi(*keys)
Rails.cache.fetch_multi(*keys) { |key| compute_value_for(key) }
# lib/tasks/cache_maintenance.rake
namespace :cache do
task vacuum: :environment do
ActiveRecord::Base.connected_to(database: :cache) do
ActiveRecord::Base.connection.execute("VACUUM ANALYZE solid_cache_entries")
end
end
end
| Choose Solid Cache When | Choose Redis When |
|---|---|
| Simplifying infrastructure | Sub-millisecond latency critical |
| Using PostgreSQL/SQLite as primary | Extremely large cache working set |
| Single-server or small clusters | Need pub/sub or complex invalidation |
| Preferring NVMe over RAM caching | Already running Redis |
| Anti-Pattern | Problem | Solution |
|---|---|---|
| Single database at scale | Resource contention | Separate cache database |
| No compression | Wasted storage | Enable ZSTD |
| Infinite expiration | Unbounded growth | Set reasonable max_age |
| No maintenance | Table bloat | Schedule VACUUM |
When configuring Solid Cache, provide:
This skill should be used when the user asks to "create a slash command", "add a command", "write a custom command", "define command arguments", "use command frontmatter", "organize commands", "create command with file references", "interactive command", "use AskUserQuestion in command", or needs guidance on slash command structure, YAML frontmatter fields, dynamic arguments, bash execution in commands, user interaction patterns, or command development best practices for Claude Code.
This skill should be used when the user asks to "create an agent", "add an agent", "write a subagent", "agent frontmatter", "when to use description", "agent examples", "agent tools", "agent colors", "autonomous agent", or needs guidance on agent structure, system prompts, triggering conditions, or agent development best practices for Claude Code plugins.
This skill should be used when the user asks to "create a hook", "add a PreToolUse/PostToolUse/Stop hook", "validate tool use", "implement prompt-based hooks", "use ${CLAUDE_PLUGIN_ROOT}", "set up event-driven automation", "block dangerous commands", or mentions hook events (PreToolUse, PostToolUse, Stop, SubagentStop, SessionStart, SessionEnd, UserPromptSubmit, PreCompact, Notification). Provides comprehensive guidance for creating and implementing Claude Code plugin hooks with focus on advanced prompt-based hooks API.