Dead simple tool for visual debugging of fragment cache
Dead simple tool for visual debugging of fragment cache.
Add this line to your application’s Gemfile:
gem 'rails-cache-inspector', group: :development
# config/initializers/rails_cache_inspector.rb
RailsCacheInspector.configuration.highlight_with = {
style: 'filter: sepia(1)', # default – 'filter: sepia(1)'
class_name: 'is-cached' # default - ''
}
Make sure caching is turned on in development environment
# config/environments/development.rb
config.action_controller.perform_caching = true
Cached fragments have blur filter in the demonstration below. It’s easy to identify potentially slow parts of the page
and make it fast again.