Rack::Cache using dalli_store responses empty assets when memcached is down #322

Open
shtoma opened this Issue Jan 24, 2013 · 3 comments

Comments

Projects
None yet
4 participants

shtoma commented Jan 24, 2013

When memcached is down, the Rack::Cache responses empty asset files.
The caches directly getting from Rails.cache.fetch block is working well,
for example,

class Category < ActiveRecord::Base def self.all_cache Rails.cache.fetch(Constants::CACHE_KEY_CATEGORY_ALL,:expires_in => 1.days) { all } end

This code works well to get data from DB when memcached is down.

How to configure Rack::Cache not to get data from dalli when memcached is down?
I hope in this case Rack::Cache not working (No cache to response assets) or
another storage using.

my log
Cache read: https://MYLOCALAPP/assets/application-common.css?body=1 down_retry_delay not reached for localhost:11211 (0.171 seconds left) DalliError: No server available Started GET "/assets/application-common.css?body=1" for 192.168.179.1 at 2013-01-24 15:34:36 +0900 Served asset /application-common.css - 200 OK (126ms) Cache write: a08d8ac8db030df981ff87a38b7d4d84bba0f10d down_retry_delay not reached for localhost:11211 (0.037 seconds left) DalliError: No server available Cache read: a08d8ac8db030df981ff87a38b7d4d84bba0f10d down_retry_delay not reached for localhost:11211 (0.037 seconds left) DalliError: No server available Cache read: https://MYLOCALAPP/assets/application-common.css?body=1 down_retry_delay not reached for localhost:11211 (0.035 seconds left) DalliError: No server available Cache write: https://MYLOCALAPP/assets/application-common.css?body=1 down_retry_delay not reached for localhost:11211 (0.027 seconds left) DalliError: No server available

my config/environments/{Rails.env}.rb (config.action_dispatch.rack_cache is not set)

config.action_controller.perform_caching = true
  config.cache_store = :dalli_store, 'localhost',
  { :namespace => Rails.application.class.parent_name, :expires_in => 10.minutes, :compress => true }

marcus commented Apr 18, 2013

+1

Collaborator

mperham commented May 27, 2013

Are you sure this isn't a Rack::Cache issue?

Owner

petergoldstein commented Dec 13, 2015

@shtoma Is this still an issue? And did you determine whether it was a Dalli or Rack::Cache issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment