The Ghosts of Action View Cache
summary
Caches rendered HTML instead of relations, so switching to Action View fragment caching fixes a bug where an ActiveRecord relation was stored in Rails.cache and prevents that class of errors. Cache keys come from action_view_digestor by hex‑digesting template source plus its dependency tree parsed by the ERB tracker (regex with an ERB‑comment fallback). A utility, action_view_precompiler, uses Ruby parsers (ripper and prism render parser) to precompile templates at boot, lowering memory and enabling a CLI that found ~5% dead view templates in one app.
AI-written summary · about
chapters (14)
- 0:00Introduction
- 1:06Rails upgrade ghost story
- 2:30Action View fragment caching
- 3:57Action View cache keys
- 6:43Memory issues with Action View
- 8:09Rails server worker forking
- 10:58Action View pre-compiler
- 13:25Template pre-compilation benefits
- 14:28Dead view templates
- 17:40Mark-sweep for dead code
- 20:49Action View improvements
- 22:56Upstreaming pre-compiler
- 24:00Rails building blocks
- 24:42Q&A








