2018-11-19 21:01:13 -05:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2017-07-10 23:35:47 -04:00
|
|
|
module Gitlab
|
|
|
|
module Redis
|
|
|
|
class Cache < ::Gitlab::Redis::Wrapper
|
2019-08-31 15:25:25 -04:00
|
|
|
CACHE_NAMESPACE = 'cache:gitlab'
|
2017-07-10 23:35:47 -04:00
|
|
|
|
2021-09-30 14:11:31 -04:00
|
|
|
# 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,
|
2022-09-09 20:09:59 -04:00
|
|
|
expires_in: ENV.fetch('GITLAB_RAILS_CACHE_DEFAULT_TTL_SECONDS', 8.hours).to_i # Cache should not grow forever
|
2021-09-30 14:11:31 -04:00
|
|
|
}
|
2017-07-10 23:35:47 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|