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:
authorDouwe Maan <douwe@gitlab.com>2016-02-17 17:07:54 +0300
committerDouwe Maan <douwe@gitlab.com>2016-02-17 17:07:54 +0300
commitf7ee31a2c364dbc7f4dc52cb5199b8d5885b4373 (patch)
tree090710f38d0cae169534e97a8c338183aa9dbc17 /app/models/repository.rb
parentcb2591e83f7e2fdf71a18673106ae9f902cdf9db (diff)
parentb1203108b0eda20f87c75004f035e9e7a51f1124 (diff)
Merge branch 'expire-fork-import-caches' into 'master'
Expire caches after forking/importing a repository cc @dblessing @DouweM Related issue: gitlab-org/gitlab-ce#13505 See merge request !2838
Diffstat (limited to 'app/models/repository.rb')
-rw-r--r--app/models/repository.rb17
1 files changed, 17 insertions, 0 deletions
diff --git a/app/models/repository.rb b/app/models/repository.rb
index 8b1ab3e9476..5a25ccb1dd6 100644
--- a/app/models/repository.rb
+++ b/app/models/repository.rb
@@ -238,6 +238,15 @@ class Repository
expire_branch_cache(branch_name)
end
+ # Expires _all_ caches, including those that would normally only be expired
+ # under specific conditions.
+ def expire_all_caches!
+ expire_cache
+ expire_root_ref_cache
+ expire_emptiness_caches
+ expire_has_visible_content_cache
+ end
+
def expire_branch_cache(branch_name = nil)
# When we push to the root branch we have to flush the cache for all other
# branches as their statistics are based on the commits relative to the
@@ -258,6 +267,14 @@ class Repository
@root_ref = nil
end
+ # Expires the cache(s) used to determine if a repository is empty or not.
+ def expire_emptiness_caches
+ cache.expire(:empty?)
+ @empty = nil
+
+ expire_has_visible_content_cache
+ end
+
def expire_has_visible_content_cache
cache.expire(:has_visible_content?)
@has_visible_content = nil