I serve the default image for users at URL / url / username / picture (very similar to facebook). An action requires several capture parameters to indicate the size and style of the image. Here is an example:
/ John / image d [] = 50 &? D [] = 50 & s = square
This will return a default 50px x 50px johns image cropped as a square.
Pressing the entire rake for each image request is clearly inefficient. I would like to cache image versions. It seems possible with a bit of a solution to this question .
caches_action :my_action, :cache_path => Proc.new { |c| c.params }
However, I need to find a way to clear the cache for all versions of the images when the user changes the default image. Basically, when john changes the default image, I would like for me to be able to clear using a regular expression like the one below, so that all thumbnails are restored to the default with the new default image:
clear cache / john / picture *
How to do it on rails?
source share