Follow Along as I Stumble on the Path to Learning RoR

Expiring Specific Cache Keys from Rails Console

I wanted to learn how to delete only certain keys from the Rails cache from the console.  Previously when I wanted to do this, I was having to delete my entire cache.

The answer I found was simple – just enter this command into the Rails console, replacing key with your key name:

ActionController::Base.new.expire_fragment(key)

 

Advertisements

Comments are closed.