Model.get_cache( 1,2,3,4 ) causes a backtrace
Reported by Lisa Seelye | June 17th, 2007 @ 03:46 PM
(Memcached version: memcached 1.2.1, Rails 1.2.3, cache_fu r269
When doing Model.get_cache (1,2,3,4) cache_fu will cause a backtrace:
Item.get_cache(640,650)
RuntimeError: Called id for nil, which would mistakenly be 4 -- if you really wanted the id of nil, use object_id
from /usr/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/core_ext/symbol.rb:10:in `__send__'
from /usr/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/core_ext/symbol.rb:10:in `to_proc'
from /usr/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/core_ext/enumerable.rb:57:in `index_by'
from /usr/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/multibyte/chars.rb:46:in `inject'
from /usr/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/core_ext/enumerable.rb:56:in `each'
from /usr/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/core_ext/enumerable.rb:56:in `inject'
from /usr/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/core_ext/enumerable.rb:56:in `index_by'
from ./script/../config/../config/../vendor/plugins/cache_fu/lib/acts_as_cached/cache_methods.rb:60:in `get_caches'
from ./script/../config/../config/../vendor/plugins/cache_fu/lib/acts_as_cached/cache_methods.rb:24:in `get_cache'
from (irb):2
This is because hits cache looks like this:
{"Item:650"=>nil, "Item:640"=>nil}
They should be misses.
This patch works for me: http://pastie.caboo.se/71247 and all tests pass.
Comments and changes to this ticket
-
Chris Wanstrath June 17th, 2007 @ 03:46 PM
- State changed from new to resolved
(from [270]) Fix miss detection with get_multi [Lisa Seelye] [#42 state:resolved]
Please Sign in or create a free account to add a new ticket.
With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป