summaryrefslogtreecommitdiff
path: root/lib/gitlab/cache/request_cache.rb
diff options
context:
space:
mode:
authorLin Jen-Shin <godfat@godfat.org>2018-06-27 16:15:06 +0800
committerLin Jen-Shin <godfat@godfat.org>2018-06-27 16:15:06 +0800
commit849f9995d97c85d88b36a40ee563f7dd51fdc3f1 (patch)
tree3523089d253b001f7e3b029266399e497407441b /lib/gitlab/cache/request_cache.rb
parentef6b3e0271d226462bed5f899f3964cf5652978c (diff)
parent87f7597a4fb7852fc81f830158cdfd5fdec8fac4 (diff)
downloadgitlab-ce-849f9995d97c85d88b36a40ee563f7dd51fdc3f1.tar.gz
Merge remote-tracking branch 'upstream/master' into 14995-custom_wiki_sidebar
* upstream/master: (4180 commits) Enable frozen string literals for app/workers/*.rb Resolve "Search dropdown hides & shows when typing" Revert merge request widget button max height Update CHANGELOG.md for 11.0.2 Update external link icon in header user dropdown Added Diff Viewer to new VUE based MR page Fixed eslint failure in IDE spec helpers Use refs instead of querySelector. Show file in tree on WebIDE open Resolve "Remove unused bootstrap component CSS" Resolve "Explain what Groups are in the New Group page" [QA] Make sure we wait for the deploy key list to load Update _scopes_form.html.haml to remove duplicate information Use the branch instead of the tag to install port the EE changes Add index on deployable_type/id for deployments Add a helper to rename a column using a background migration Fix performance bottleneck when rendering large wiki pages Port Namespace#root_ancestor to CE Remove duplicate spec ...
Diffstat (limited to 'lib/gitlab/cache/request_cache.rb')
-rw-r--r--lib/gitlab/cache/request_cache.rb37
1 files changed, 1 insertions, 36 deletions
diff --git a/lib/gitlab/cache/request_cache.rb b/lib/gitlab/cache/request_cache.rb
index ecc85f847d4..671b8e7e1b1 100644
--- a/lib/gitlab/cache/request_cache.rb
+++ b/lib/gitlab/cache/request_cache.rb
@@ -1,41 +1,6 @@
module Gitlab
module Cache
- # This module provides a simple way to cache values in RequestStore,
- # and the cache key would be based on the class name, method name,
- # optionally customized instance level values, optionally customized
- # method level values, and optional method arguments.
- #
- # A simple example:
- #
- # class UserAccess
- # extend Gitlab::Cache::RequestCache
- #
- # request_cache_key do
- # [user&.id, project&.id]
- # end
- #
- # request_cache def can_push_to_branch?(ref)
- # # ...
- # end
- # end
- #
- # This way, the result of `can_push_to_branch?` would be cached in
- # `RequestStore.store` based on the cache key. If RequestStore is not
- # currently active, then it would be stored in a hash saved in an
- # instance variable, so the cache logic would be the same.
- # Here's another example using customized method level values:
- #
- # class Commit
- # extend Gitlab::Cache::RequestCache
- #
- # def author
- # User.find_by_any_email(author_email.downcase)
- # end
- # request_cache(:author) { author_email.downcase }
- # end
- #
- # So that we could have different strategies for different methods
- #
+ # See https://docs.gitlab.com/ee/development/utilities.html#requestcache
module RequestCache
def self.extended(klass)
return if klass < self