Consider the following. From my heroku console:
>> Rails.cache.stats
=> {"server_id"=>{"evictions"=>"0", "curr_items"=>"2064", "total_items"=>"18793", "bytes"=>"7674501", ...
>> Rails.cache.clear
=> [true]
>> Rails.cache.stats
=> {"server_id"=>{"evictions"=>"0", "curr_items"=>"2064", "total_items"=>"18793", "bytes"=>"7674501",
Super weird -- how can I clear my cache!!
Similar Issue ? : https://stackoverflow.com/q/7122513/192791
If you connect directly to the Dalli/memcahced client through the console and flush_all the cache clears.
i.e.
dc = Dalli::Client.new('localhost:11211')
dc.flush_all
NOTE: the stats take a while to update, but the cache will definitely clear.
The Expiring Cache section at http://devcenter.heroku.com/articles/building-a-rails-3-application-with-the-memcache-addon suggests using filters
after_save :expire_contact_all_cache
after_destroy :expire_contact_all_cache
def expire_contact_all_cache
Rails.cache.delete('Contact.all')
end
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With