Closed purcell closed 12 years ago
And just to clarify, I'm on version 3.2.3 of Rails / ActionPack / ActionSupport.
I'm having the same issue.
ArgumentError (key too long "sessions:BAh7CEkiD3Nlc3Npb25faWQGOgZFRkkiJWVmOTlmODIyMzM2ZTQ1NWJjMTFkYTA1Yzg4YjMwMGY5BjsAVEkiEF9jc3JmX3Rva2VuBjsARkkiMXNXVWJOaXBubHRtdnFXMi9kOVFrQTA0VE1aZG9MelBFUVNPUlhNbTdkUFE9BjsARkkiEHJldHVybl9wYXRoBjsARiIRL3Blcm1pc3Npb25z--bfc2d389f73b959a86257792bb2c43f9f1eabbb4")
Same Rails 3.2.3, Ruby 1.9.3p194, memcached 1.4.13. Trying to use dalli_store for session_store and cache_store.
Just double-checked: I was on Dalli 2.0.3 before the update (not 2.0.4 as previously stated).
Ok, managed to get it working... unsure what I did that made it work though, here's my config:
# config/environment/development.rb
config.cache_store = :dalli_store #, 'localhost:11211'
config.perform_caching = true
# config/initializers/session_store.rb
require 'action_dispatch/middleware/session/dalli_store'
Security::Application.config.session_store :dalli_store #, 'localhost:11211'
I followed the wiki to set it up (https://github.com/mperham/dalli/wiki/Caching-with-Rails). However, I had to remove the server address, got the following error:
/Users/Dom/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/dalli-2.0.5/lib/action_dispatch/middleware/session/dalli_store.rb:11:in `[]': can't convert Symbol into Integer (TypeError)
Also shortened my config.secret_token
in config/initializers/secret_token.rb
to 30 characters, not sure if this contributed to it working.
Still getting this with Rails 3.2.6:
A ActionView::Template::Error occurred in news_items#show:
key too long "ltts:views/www.looktothestars.org/news/8466-christy-turlington-and-donna-karan-attend-hudson-river-park-event?news_item=8466-christy-turlington-and-donna-karan-attend-hudson-river-park-event&suffix=related_videos&user=none&ver=2012-06-12+15%253A20%253A00"
dalli (2.0.5) lib/dalli/client.rb:260:in `validate_key'
dalli (2.0.5) lib/dalli/client.rb:260:in `validate_key'
dalli (2.0.5) lib/dalli/client.rb:246:in `perform'
dalli (2.0.5) lib/dalli/client.rb:48:in `get'
(eval):7:in `block in get_with_newrelic_trace'
newrelic_rpm (3.3.5) lib/new_relic/agent/method_tracer.rb:242:in `trace_execution_scoped'
(eval):4:in `get_with_newrelic_trace'
dalli (2.0.5) lib/active_support/cache/dalli_store.rb:182:in `read_entry'
dalli (2.0.5) lib/active_support/cache/dalli_store.rb:79:in `block in read'
dalli (2.0.5) lib/active_support/cache/dalli_store.rb:248:in `instrument'
dalli (2.0.5) lib/active_support/cache/dalli_store.rb:78:in `read'
actionpack (3.2.6) lib/action_controller/caching/fragments.rb:75:in `block in read_fragment'
actionpack (3.2.6) lib/action_controller/caching/fragments.rb:123:in `block in instrument_fragment_cache'
activesupport (3.2.6) lib/active_support/notifications.rb:123:in `block in instrument'
activesupport (3.2.6) lib/active_support/notifications/instrumenter.rb:20:in `instrument'
activesupport (3.2.6) lib/active_support/notifications.rb:123:in `instrument'
actionpack (3.2.6) lib/action_controller/caching/fragments.rb:123:in `instrument_fragment_cache'
actionpack (3.2.6) lib/action_controller/caching/fragments.rb:74:in `read_fragment'
actionpack (3.2.6) lib/action_view/helpers/cache_helper.rb:47:in `fragment_for'
haml (3.1.6) lib/haml/helpers/action_view_mods.rb:200:in `fragment_for_with_haml'
actionpack (3.2.6) lib/action_view/helpers/cache_helper.rb:36:in `cache'
(As before, this is with a hash passed as the key to cache
.)
-Steve
Seems to be fixed in 2.1.0 -- thanks!
I just updated to 2.0.5 from 2.0.4, and started getting these errors:
Looking through the changelog for 2.0.5, I see that this is exactly one of problems that was fixed (see #202, #209, #212), so I'm confused.
Sure enough, the
ltts:
namespace prefix is tipping the key length over the 250 char limit:The code which triggers the error is an invocation of the standard Rails
cache
helper function, with the key passed a hash of strings.Am I missing something?
(P.S. Thanks so much for Dalli - I've been delighted with it since adopting it right after its initial release.)