artsy / garner

A set of Rack middleware and cache helpers that implement various caching strategies.
MIT License
343 stars 24 forks source link

SafeCacheKey + Touch doesn't pass spec/integration/mongoid_spec.rb #83

Open dblock opened 10 years ago

dblock commented 10 years ago

SafeCacheKey + Touch doesn't pass spec/integration/mongoid_spec.rb.

  1) Mongoid integration using Garner::Strategies::Binding::Key::SafeCacheKey with Garner::Strategies::Binding::Invalidation::Touch end-to-end caching and invalidation binding at the instance level binding via find does not invalidate results for other like-classed objects
     Failure/Error: cached_object_namer.call.should eq 'M1'

       expected: "M1"
            got: "M2"

       (compared using ==)
     # ./spec/integration/mongoid_spec.rb:176:in `block (8 levels) in <top (required)>'
     # ./spec/support/active_record.rb:32:in `block (3 levels) in <top (required)>'
     # ./spec/support/active_record.rb:31:in `block (2 levels) in <top (required)>'

  2) Mongoid integration using Garner::Strategies::Binding::Key::SafeCacheKey with Garner::Strategies::Binding::Invalidation::Touch end-to-end caching and invalidation binding at the instance level binding via find with an embedded document with :invalidate_mongoid_root = true invalidates the root document
     Failure/Error: root_cached_object_namer.call.should eq 'Sockeye'

       expected: "Sockeye"
            got: "Trout"

       (compared using ==)
     # ./spec/integration/mongoid_spec.rb:269:in `block (10 levels) in <top (required)>'
     # ./spec/support/active_record.rb:32:in `block (3 levels) in <top (required)>'
     # ./spec/support/active_record.rb:31:in `block (2 levels) in <top (required)>'

  3) Mongoid integration using Garner::Strategies::Binding::Key::SafeCacheKey with Garner::Strategies::Binding::Invalidation::Touch end-to-end caching and invalidation binding at the instance level binding via identify does not invalidate results for other like-classed objects
     Failure/Error: cached_object_namer.call.should eq 'M1'

       expected: "M1"
            got: "M2"

       (compared using ==)
     # ./spec/integration/mongoid_spec.rb:176:in `block (8 levels) in <top (required)>'
     # ./spec/support/active_record.rb:32:in `block (3 levels) in <top (required)>'
     # ./spec/support/active_record.rb:31:in `block (2 levels) in <top (required)>'

  4) Mongoid integration using Garner::Strategies::Binding::Key::SafeCacheKey with Garner::Strategies::Binding::Invalidation::Touch end-to-end caching and invalidation binding at the instance level binding via identify with an embedded document with :invalidate_mongoid_root = true invalidates the root document
     Failure/Error: root_cached_object_namer.call.should eq 'Sockeye'

       expected: "Sockeye"
            got: "Trout"

       (compared using ==)
     # ./spec/integration/mongoid_spec.rb:269:in `block (10 levels) in <top (required)>'
     # ./spec/support/active_record.rb:32:in `block (3 levels) in <top (required)>'
     # ./spec/support/active_record.rb:31:in `block (2 levels) in <top (required)>'
dblock commented 8 years ago

A simple example where you bind on a model doesn't work either, the following code never hits the cache.

get do
   garner.bind(Widget) do
       Widget.all
   end
end