identity_cache icon indicating copy to clipboard operation
identity_cache copied to clipboard

An option to skip should_use_cache? method

Open dotai2012 opened this issue 3 years ago • 0 comments

I've just found that if a query is wrapped inside a transaction, IdentityCache will call the database directly

https://github.com/Shopify/identity_cache/blob/8fcaa32633bb3406c01adc32147a0e0c85aff56b/lib/identity_cache.rb#L151

However, in my case, there are some models doesn't need this (read a lot and rarely write)

Is there an option to skip this feature? Eg:

class TestModel < ApplicationRecord
  include IdentityCache
  skip_transaction: true
end

dotai2012 avatar Aug 26 '22 03:08 dotai2012