Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'lib/api/files.rb')
-rw-r--r--lib/api/files.rb15
1 files changed, 10 insertions, 5 deletions
diff --git a/lib/api/files.rb b/lib/api/files.rb
index 45e935d7ea2..c140cec658d 100644
--- a/lib/api/files.rb
+++ b/lib/api/files.rb
@@ -49,7 +49,14 @@ module API
end
def content_sha
- cache_client.fetch("blob_content_sha256:#{user_project.full_path}:#{@blob.id}") do
+ cache_client.fetch(
+ "blob_content_sha256:#{user_project.full_path}:#{@blob.id}",
+ nil,
+ {
+ cache_identifier: 'API::Files#content_sha',
+ backing_resource: :gitaly
+ }
+ ) do
@blob.load_all_data!
Digest::SHA256.hexdigest(@blob.data)
@@ -57,10 +64,8 @@ module API
end
def cache_client
- Gitlab::Cache::Client.build_with_metadata(
- cache_identifier: 'API::Files#content_sha',
- feature_category: :source_code_management,
- backing_resource: :gitaly
+ @cache_client ||= Gitlab::Cache::Client.new(
+ Gitlab::Cache::Metrics.new(Gitlab::Cache::Metadata.new(feature_category: :source_code_management))
)
end