diff options
author | Andrew Newdigate <andrew@gitlab.com> | 2019-07-19 16:09:25 +0200 |
---|---|---|
committer | Andrew Newdigate <andrew@gitlab.com> | 2019-07-23 11:44:32 +0200 |
commit | 653126fe996f2318049ce39b3c8f0e2907e7b8f0 (patch) | |
tree | 5bfef646e1548408c1ec2ccb2372b43ea549d24b /config/application.rb | |
parent | e45549e88cfaffc1cf1196dcdea23ec6bbc74a63 (diff) | |
download | gitlab-ce-an-multi-level-cache-store.tar.gz |
Opt out of L1 cache for operations that perform invalidationan-multi-level-cache-store
Diffstat (limited to 'config/application.rb')
-rw-r--r-- | config/application.rb | 21 |
1 files changed, 2 insertions, 19 deletions
diff --git a/config/application.rb b/config/application.rb index d6a2a1bb475..3da204ac02e 100644 --- a/config/application.rb +++ b/config/application.rb @@ -15,6 +15,7 @@ module Gitlab require_dependency Rails.root.join('lib/gitlab') require_dependency Rails.root.join('lib/gitlab/redis/wrapper') require_dependency Rails.root.join('lib/gitlab/redis/cache') + require_dependency Rails.root.join('lib/gitlab/cache/store') require_dependency Rails.root.join('lib/gitlab/redis/queues') require_dependency Rails.root.join('lib/gitlab/redis/shared_state') require_dependency Rails.root.join('lib/gitlab/request_context') @@ -228,25 +229,7 @@ module Gitlab end end - # Use caching across all environments - caching_config_hash = Gitlab::Redis::Cache.params - caching_config_hash[:namespace] = Gitlab::Redis::Cache::CACHE_NAMESPACE - caching_config_hash[:expires_in] = 2.weeks # Cache should not grow forever - if Sidekiq.server? # threaded context - caching_config_hash[:pool_size] = Sidekiq.options[:concurrency] + 5 - caching_config_hash[:pool_timeout] = 1 - end - - l1_cache_size_mb = ENV['GITLAB_L1_RAILS_CACHE_SIZE_MB'].to_i - if l1_cache_size_mb > 0 # rubocop:disable Style/ConditionalAssignment - config.cache_store = :level2, { - L1: [:memory_store, size: l1_cache_size_mb.megabytes, expires_in: 1.minute, race_condition_ttl: 1.second], - L2: [:redis_store, caching_config_hash] - } - else - config.cache_store = :redis_store, caching_config_hash - end - + config.cache_store = Gitlab::Cache::Store.cache config.active_job.queue_adapter = :sidekiq # This is needed for gitlab-shell |