Identity cache inside transaction
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 42/100
Hướng nghiên cứu
Bắt đầu bằng cách theo dõi ApplicationRecord.fetch và quyết định should_use_cache? xung quanh các transaction của ActiveRecord. Tái hiện ví dụ lồng nhau với requires_new và joinable: false, sau đó xác minh rằng việc đọc cache diễn ra ở đó mà không thay đổi hành vi nhất quán của cache trong các transaction khác.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Identity cache gem does not fetch from the cache store when fetch method was used inside any transaction, this is to avoid inconsistency in cache data as the changes will be commited at the end of transaction.
But they might be use case where we only load and not do updation. One way to solve this having a transaction which is not joinable to parent transaction. Usually identity_cache has should_use_cache? method which decides to fetch from cache or DB. should_use_cache? checks for any open transaction which is joinable, if so it make the DB call instead of fetching from cache. But if we wrap the fetch call inside transaction which is new and not joinable , then we can make use of advantage of the cache store and can save query at many places.
In the below code, fetch is happening inside the new transaction which is not joinable, should_use_cache? method returns true in this case and fetch from cache store.
Sample code:
ApplicationRecord.transaction do
ApplicationRecord.transaction(requires_new: true, joinable: false) do
ApplicationRecord.fetch(1)
end
end
- Ngôn ngữ chính
- Ruby
- Star
- 2k
- Fork
- 175
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của Shopify/identity_cache
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
Shopify/identity_cache#568 · 1 bình luận ·
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
Shopify/identity_cache#555 ·
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 25/100
Shopify/identity_cache#539 ·
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 30/100
Shopify/identity_cache#535 · 1 bình luận ·
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 25/100
Shopify/identity_cache#525 · 4 bình luận ·
Tất cả issue của Shopify/identity_cache
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
ublue-os/homebrew-experimental-tap#774 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
accessibility
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 72/100
slovensko-digital/ops-portal#212 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Don't expose useless actions....Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
-
Local evaluation buckets percentage splits with the server key, so results differ from FlagsmithĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
-
Add PrestashopĐang mởrequest
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
endoflife-date/endoflife.date#11303 ·
Maintainer thường phản hồi trong vòng 1 ngày