1

My rails 3.2 app is trying to fetch values from the cache (memcached via dalli) that I'm not expecting it to be caching. It's not getting any cache hits, but I'm puzzled about what is going on. This happens with config.action_controller.perform_caching = true on production as well as development, using WEBrick.

Here's a snippet of what I'm seeing in memcache verbose output:

<30 GET https://www.myrailsapp.com/?
>30 Writing an error: Not found
>30 Writing bin response:
>30   0x81 0x00 0x00 0x00
>30   0x00 0x00 0x00 0x01
>30   0x00 0x00 0x00 0x09
>30   0x00 0x00 0x00 0x00
>30   0x00 0x00 0x00 0x00
>30   0x00 0x00 0x00 0x00
<30 Read binary protocol data:
<30    0x80 0x00 0x00 0xd0
<30    0x00 0x00 0x00 0x00
<30    0x00 0x00 0x00 0xd0
<30    0x00 0x00 0x00 0x00
<30    0x00 0x00 0x00 0x00
<30    0x00 0x00 0x00 0x00

Note that there is only a cache GET and I'm not seeing any cache writes.

I see similar cache GET attempts for all my actions, most of which are JSON API calls. All of them result in a cache miss. Like this,

<31 GET https://www.myrailsapp.com/api/somecall?param1=foo&param2=bar
>31 Writing an error: Not found

I have not specified any caches_action directives anywhere in my app.

Is this a rails bug?

If no, where should I look to stop these unnecessary cache GETs?

Thanks.

4

1 回答 1

0

As per cswilliams on the Github thread you've posted:

It appears to be an issue with the rack_cache being enabled by default (since updated in the master branch).

Disabling it in your application or environments properties file (e.g., config/environments/development.rb) seems to resolve the issue:

config.action_dispatch.rack_cache = false
于 2013-09-13T13:36:07.733 回答