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
path: root/app
diff options
context:
space:
mode:
authorMichael Kozono <mkozono@gmail.com>2018-09-25 20:12:51 +0300
committerMichael Kozono <mkozono@gmail.com>2018-09-28 04:22:37 +0300
commit3640292bf2ef822c8e2394fa2397b1b7d04e9891 (patch)
treee6083dca766e7acfb94b613329a43c98a8aa526b /app
parentd9c4ebc5a0b2e911f17865e482de1dfcc2189ac3 (diff)
Cache `Repository#exists?` false in RequestStore
* Only truthy values are cached in Redis. * All values are cached in RequestStore and in an instance variable.
Diffstat (limited to 'app')
-rw-r--r--app/models/repository.rb6
1 files changed, 5 insertions, 1 deletions
diff --git a/app/models/repository.rb b/app/models/repository.rb
index 7a6dfada917..4fecdb3c1ad 100644
--- a/app/models/repository.rb
+++ b/app/models/repository.rb
@@ -510,7 +510,7 @@ class Repository
raw_repository.exists?
end
- cache_method :exists?
+ cache_method_asymmetrically :exists?
# We don't need to cache the output of this method because both exists? and
# has_visible_content? are already memoized and cached. There's no guarantee
@@ -1029,6 +1029,10 @@ class Repository
@cache ||= Gitlab::RepositoryCache.new(self)
end
+ def request_store_cache
+ @request_store_cache ||= Gitlab::RepositoryCache.new(self, backend: Gitlab::SafeRequestStore)
+ end
+
def tags_sorted_by_committed_date
tags.sort_by do |tag|
# Annotated tags can point to any object (e.g. a blob), but generally