Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Heroku action caching doesn't seem to work

I have been playing around with different caching strategies on Heroku and have add their memcached add-on with an aim to add action caching to my app.

When I view Rails.cache.stats on my current app however (with memcached installed and using the dalli gem) I get current and total_items at 0 after performing the actions that should be cached.

At the top of the controller with the action I want to cache I have:

caches_action :show

Also, I modified my environment config (for the one running on Heroku) to have

config.cache_store = :dalli_store

Is there some other stats I can look at to see if it is working or have I done something wrong?

like image 384
seadowg Avatar asked Aug 03 '11 11:08

seadowg


People also ask

Does heroku cache?

Heroku doesn't provide HTTP caching by default. In order to take advantage of HTTP caching, you'll need to configure your application to set the appropriate HTTP cache control headers and use a content delivery network (CDN) or other external caching service.

How does Rails caching work?

Query caching is a Rails feature that caches the result set returned by each query. If Rails encounters the same query again for that request, it will use the cached result set as opposed to running the query against the database again.


1 Answers

You need to enable caching as well as configuring a cache store:

config.action_controller.perform_caching             = true
like image 105
Winfield Avatar answered Oct 03 '22 20:10

Winfield