simple_cacheable
simple_cacheable copied to clipboard
cache keys for non persisted objects
user1 = User.new(attributes)
user1.cached_method
#=> data
user2 = User.new(diff_attributes)
user2.cached_method
#=> user1's data
When an object isn't persisted, it doens't have a fully formed cache key, so it uses a shared one. This isn't a problem often, but it could be solved by not caching information for non persisted objects.