Shopify / Shopify/identity_cache
An option to skip should_use_cache? method
Nobody has claimed this yet.
- Dominant language
- Ruby
- Stars
- 2k
- Forks
- 174
- Avg merge
- 13m
- Merged PRs (30d)
- 3
Description
I've just found that if a query is wrapped inside a transaction, IdentityCache will call the database directly
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
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in lib/identity_cache.rb around line 151, where should_use_cache? is referenced, and trace how transaction handling is applied to included models. Define how a per-model skip_transaction option should affect that behavior, then verify the requested TestModel configuration works without bypassing normal caching elsewhere.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rails, ruby
- Domain
- backend
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100