I have a json api where i perform action caching :
class Api::V2::TagsController < Api::V2::BaseController
before_filter :set_cache_headers, :only => [:categories, :tribes]
caches_action :categories, :tribes, :expires_in => 1.hour
The only way i found to expire this cache is to use :
Rails.cache.delete api_v2_categories_url(:locale => nil)+'.json?'
This is terribly ugly
Please can anyone help me improve this terrible hack ?
More informations :
Caching works great and i see cache writes in logs :
Cache write: http://localhost:3000/api/v2/categories.json?
In an admin namespace i need to expire the cache, i've tried :
expire_action(:controller => '/api/v2/tags', :action => 'categories', :format => :json)
Which fails and outputs :
Expire fragment views/localhost:3000/mu-8c54ade2-cbb77ba0-4f0c28d3-607169d0.json?action=categories&controller=api/v2/tags&locale=fr
P.S: I've tried this answer without success: rails caching: expire_action in another namespace