2019-02-15 15:39:39 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2017-09-10 17:25:29 +05:30
|
|
|
module Gitlab
|
|
|
|
module Redis
|
|
|
|
class Cache < ::Gitlab::Redis::Wrapper
|
2019-12-04 20:38:33 +05:30
|
|
|
CACHE_NAMESPACE = 'cache:gitlab'
|
2017-09-10 17:25:29 +05:30
|
|
|
|
2021-11-18 22:05:49 +05:30
|
|
|
# Full list of options:
|
|
|
|
# https://api.rubyonrails.org/classes/ActiveSupport/Cache/RedisCacheStore.html#method-c-new
|
|
|
|
def self.active_support_config
|
|
|
|
{
|
|
|
|
redis: pool,
|
|
|
|
compress: Gitlab::Utils.to_boolean(ENV.fetch('ENABLE_REDIS_CACHE_COMPRESSION', '1')),
|
|
|
|
namespace: CACHE_NAMESPACE,
|
|
|
|
expires_in: 2.weeks # Cache should not grow forever
|
|
|
|
}
|
2017-09-10 17:25:29 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|