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:
authorJacob Vosmaer <contact@jacobvosmaer.nl>2016-03-07 16:27:53 +0300
committerJacob Vosmaer <contact@jacobvosmaer.nl>2016-03-07 16:27:53 +0300
commit41bc9c463c187396e47b4a942965de6ecddca5a1 (patch)
tree620214ebf7850bdd2c9bd2424a66be6e732afcc7 /app/models/blob.rb
parenta215e2ee8ddaefbfef16669ad0bd8ccd6853e163 (diff)
Refactor caching code
Diffstat (limited to 'app/models/blob.rb')
-rw-r--r--app/models/blob.rb3
1 files changed, 3 insertions, 0 deletions
diff --git a/app/models/blob.rb b/app/models/blob.rb
index 8ee9f3006b2..72e6c5fa3fd 100644
--- a/app/models/blob.rb
+++ b/app/models/blob.rb
@@ -1,5 +1,8 @@
# Blob is a Rails-specific wrapper around Gitlab::Git::Blob objects
class Blob < SimpleDelegator
+ CACHE_TIME = 60 # Cache raw blobs referred to by a (mutable) ref for 1 minute
+ CACHE_TIME_IMMUTABLE = 3600 # Cache blobs referred to by an immutable reference for 1 hour
+
# Wrap a Gitlab::Git::Blob object, or return nil when given nil
#
# This method prevents the decorated object from evaluating to "truthy" when