Shopify / identity_cache

IdentityCache is a blob level caching solution to plug into Active Record. Don't #find, #fetch!
http://shopify.github.io/identity_cache
MIT License
1.92k stars 173 forks source link

Looks like the Rails.configuration.identity_cache_store != IdentityCache.cache #27

Closed RobWu closed 11 years ago

RobWu commented 11 years ago

Rails.configuration.identity_cache_store is set to Memcached::Rails IdentityCache.cache is set to ActiveSupport::Cache::FileStore

Should not both use Memcached::Rails as defined in Rails.configuration.identity_cache_store?

1.9.3p385 :005 > Rails.configuration.identity_cache_store
 => [:mem_cache_store, #<Memcached::Rails:0xa6d19b0 @logger=nil, @string_return_types=nil, @struct=#<Rlibmemcached::MemcachedSt:0xa6d1848>, @options={:hash=>:fnv1_32, :no_block=>false, :noreply=>false, :distribution=>:consistent_ketama, :ketama_weighted=>true, :buffer_requests=>false, :cache_lookups=>true, :support_cas=>false, :tcp_nodelay=>false, :show_backtraces=>false, :retry_timeout=>30, :timeout=>0.25, :rcv_timeout=>0.25, :poll_timeout=>0.25, :connect_timeout=>4, :prefix_key=>"", :prefix_delimiter=>"", :hash_with_prefix_key=>true, :default_ttl=>604800, :default_weight=>8, :sort_hosts=>false, :auto_eject_hosts=>true, :server_failure_limit=>2, :verify_key=>true, :use_udp=>false, :binary_protocol=>false, :credentials=>nil, :experimental_features=>false, :exception_retry_limit=>5, :exceptions_to_retry=>[Memcached::ServerIsMarkedDead, Memcached::ATimeoutOccurred, Memcached::ConnectionBindFailure, Memcached::ConnectionFailure, Memcached::ConnectionSocketCreateFailure, Memcached::Failure, Memcached::MemoryAllocationFailure, Memcached::ReadFailure, Memcached::ServerEnd, Memcached::ServerError, Memcached::SystemError, Memcached::UnknownReadFailure, Memcached::WriteFailure, Memcached::SomeErrorsWereReported]}, @default_ttl=604800, @not_found=#<Memcached::NotFound: Memcached::NotFound>, @not_stored=#<Memcached::NotStored: Memcached::NotStored>>] 
1.9.3p385 :006 > IdentityCache.cache
 => #<IdentityCache::MemoizedCacheProxy:0xba24bac @memcache=#<ActiveSupport::Cache::FileStore:0xa834514 @options={}, @cache_path="/home/row/code/mannaz/mannaz-business-bootcamp/tmp/cache/", @thread_local_key=:active_support_cache_file_store_local_cache_88187530, @middleware=#<ActiveSupport::Cache::Strategy::LocalCache::Middleware:0xb3f57b8 @name="ActiveSupport::Cache::Strategy::LocalCache", @thread_local_key=:active_support_cache_file_store_local_cache_88187530, @app=#<Rack::Runtime:0xa9e0b4c @app=#<Rack::MethodOverride:0xa9e0c3c @app=#<ActionDispatch::RequestId:0xa9e0d18 @app=#<Rails::Rack::Logger:0xa9e0db8 @app=#<ActionDispatch::ShowExceptions:0xa9e0e08 @app=#<ActionDispatch::DebugExceptions:0xa9e0e80 @app=#<BetterErrors::Middleware:0xa9e0fc0 @app=#<Airbrake::Rails::Middleware:0xa9e1268 @app=#<ActionDispatch::RemoteIp:0xa9e136c @app=#<ActionDispatch::Reloader:0xa9e13bc @app=#<ActionDispatch::Callbacks:0xa9e1574 @app=#<ActiveRecord::ConnectionAdapters::ConnectionManagement:0xa9e17cc @app=#<ActiveRecord::QueryCache:0xa9e1b3c @app=#<ActionDispatch::Cookies:0xa9e1c04 @app=#<Rack::P3p:0xa9e1c2c @app=#<ActionDispatch::Session::CookieStore:0xa9e24d8 @secrets=["21197a4b3195792ad56740ac245309a1bb2d448e9ed964704ad879a5055c"], @coder=#<Rack::Session::Cookie::Base64::Marshal:0xa9e1d80>, @app=#<ActionDispatch::Flash:0xa9e2514 @app=#<ActionDispatch::ParamsParser:0xa9e2848 @app=#<ActionDispatch::Head:0xa9e2910 @app=#<Rack::ConditionalGet:0xa9e2960 @app=#<Rack::ETag:0xa9e2a14 @app=#<ActionDispatch::BestStandardsSupport:0xa9d7920 @app=#<Warden::Manager:0xa9d7ce0 @config={:default_scope=>:admin_user, :scope_defaults=>{}, :default_strategies=>{:admin_user=>[:rememberable, :database_authenticatable]}, :intercept_401=>false, :failure_app=>#<Devise::Delegator:0xae477a8>}, @app=#<Rack::MobileDetect:0xa9d91d0 @app=#<ActionDispatch::Routing::RouteSet:0xa9bd354>, @regex_ua_targeted=/iphone|android|ipod|ipad/i, @regex_accept=/vnd\.wap/i, @regex_ua_catchall=/palm|blackberry|nokia|phone|midp|mobi|symbian|chtml|ericsson|minimo|audiovox|motorola|samsung|telit|upg1|windows ce|ucweb|astel|plucker|x320|x240|j2me|sgh|portable|sprint|docomo|kddi|softbank|android|mmp|pdxgw|netfront|xiino|vodafone|portalmmm|sagem|mot-|sie-|ipod|up\.b|webos|amoi|novarra|cdm|alcatel|pocket|ipad|iphone|mobileexplorer|mobile/i, @redirect_to=nil, @redirect_map=nil>>, @header="IE=Edge">, @cache_control="max-age=0, private, must-revalidate", @no_cache_control="no-cache">>>, @parsers={application/xml=>:xml_simple, application/json=>:json}>>, @default_options={:path=>"/", :domain=>nil, :expire_after=>nil, :secure=>false, :httponly=>true, :defer=>false, :renew=>false, :secret=>"21197a4b3195792ad56740ac245309a1bb2d448e9ed964704ad879a5055c", :coder=>#<Rack::Session::Cookie::Base64::Marshal:0xa9e1d80>}, @key="_mannaz-business-bootcamp_session", @cookie_only=true>>>>>>, @condition=#<Proc:0xaa06cc0@/home/row/.rvm/gems/ruby-1.9.3-p385@mannaz-bb/gems/railties-3.2.13/lib/rails/application.rb:267 (lambda)>, @validated=true>, @check_ip=true, @proxies=/
      ^127\.0\.0\.1$                | # localhost
      ^(10                          | # private IP 10.x.x.x
        172\.(1[6-9]|2[0-9]|3[0-1]) | # private IP in the range 172.16.0.0 .. 172.31.255.255
        192\.168                      # private IP 192.168.x.x
       )\.
    /x>>, @handler=BetterErrors::ErrorPage>>, @exceptions_app=#<ActionDispatch::PublicExceptions:0xaac48ec @public_path="/home/row/code/mannaz/mannaz-business-bootcamp/public">>, @taggers=[]>>>, @header_name="X-Runtime">>>, @key_value_maps={}> 
1.9.3p385 :007 > 
camilo commented 11 years ago

Were you setting Rails.configuration.identity_cache_store in the context of config/environments/#{env}.rb ?

camilo commented 11 years ago

Also see aea4acfc7fccad1ab08f97505a4ff5e15d56b2aa which I added in response to #28