views:

337

answers:

2

I'm using page caching within my application. Everything works fine locally. But after I push changes to heroku server. Caching expiration won't work. I use sweepers to track and expire cached pages.

Here's config for caching in the production.rb

config.cache_store = :memory_store
#config.cache_store = :file_store, 'tmp/cache/'
I tried both ways nothing work.

Maybe there's some specific configuration which I don't know.

+3  A: 

The :memory_store won't work with Heroku, and :file_store will only work in ./tmp on the current Dyno (Dynos don't know about each other). They're working on supporting Memcached in beta and you can check out the other docs on taking advantage of Varnish: http://docs.heroku.com/http-caching

bensie
A: 

Heroku converts regular rails page caching (which writes files to disk, no-go on their read-only filesystems) to use cache-control HTTP headers instead. Of course with this you lose the ability to expire the cache. You can only do :expires_in => some.minutes.

Check out action caching instead.

tfe