Create a wrapper for Rails.cache with metrics support
What does this MR do and why?
Contributes to #383458 (closed)
Problem
We don't have hit-rate and time of generation metrics for Redis cache
Solution
Create a in-place replacement for Rails.cache call with metrics integrations
Roadmap
Step | MR |
---|---|
Refactor Gitlab::Cache::Metrics
|
!111345 (merged) |
Create Gitlab::Cache::Client
|
|
Example
Before
Rails.cache.fetch("blob_content_sha256:#{user_project.full_path}:#{@blob.id}") do
@blob.load_all_data!
Digest::SHA256.hexdigest(@blob.data)
end
After
cache_client = Gitlab::Cache::Client.meta(
feature_category: :source_code_management,
cache_identifier: "#{self.class}#content_sha"
)
cache_client.fetch("blob_content_sha256:#{user_project.full_path}:#{@blob.id}") do
@blob.load_all_data!
Digest::SHA256.hexdigest(@blob.data)
end
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Edited by Vasilii Iakliushin