diff options
author | Francisco Lopez <fjlopez@gitlab.com> | 2017-11-24 19:37:02 +0300 |
---|---|---|
committer | Francisco Lopez <fjlopez@gitlab.com> | 2017-12-01 20:32:12 +0300 |
commit | c85f9c5b1d320f7a6f75e3d08bbafd2fb20d3f58 (patch) | |
tree | caad702f39ef47d1a2ec710eb93b776ecd4910ef /app/services/base_count_service.rb | |
parent | 7c7877b54dfb0a07bf128102226e338463654431 (diff) |
Code review comments applied
Diffstat (limited to 'app/services/base_count_service.rb')
-rw-r--r-- | app/services/base_count_service.rb | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/app/services/base_count_service.rb b/app/services/base_count_service.rb index 2e4fd1db03e..f2844854112 100644 --- a/app/services/base_count_service.rb +++ b/app/services/base_count_service.rb @@ -12,6 +12,10 @@ class BaseCountService Rails.cache.fetch(cache_key, cache_options) { uncached_count }.to_i end + def count_stored? + Rails.cache.read(cache_key).present? + end + def refresh_cache(&block) Rails.cache.write(cache_key, block_given? ? yield : uncached_count, raw: raw?) end |