diff options
author | Francisco Lopez <fjlopez@gitlab.com> | 2017-11-24 15:20:52 +0300 |
---|---|---|
committer | Francisco Lopez <fjlopez@gitlab.com> | 2017-12-01 20:32:12 +0300 |
commit | a2babf32fe2b57850bd678919947d53e5127f6fe (patch) | |
tree | 1fb69dfe55a17b894a72878fc351946c78692629 /app/services/base_count_service.rb | |
parent | dd562ae749db805c7c2c764f4e8b6082009df17f (diff) |
More preloading improvement and added batch count services
Diffstat (limited to 'app/services/base_count_service.rb')
-rw-r--r-- | app/services/base_count_service.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/app/services/base_count_service.rb b/app/services/base_count_service.rb index 19873fe09a5..2e4fd1db03e 100644 --- a/app/services/base_count_service.rb +++ b/app/services/base_count_service.rb @@ -12,8 +12,8 @@ class BaseCountService Rails.cache.fetch(cache_key, cache_options) { uncached_count }.to_i end - def refresh_cache - Rails.cache.write(cache_key, uncached_count, raw: raw?) + def refresh_cache(&block) + Rails.cache.write(cache_key, block_given? ? yield : uncached_count, raw: raw?) end def uncached_count |