debian-mirror-gitlab/lib/gitlab/redis/repository_cache.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

27 lines
804 B
Ruby
Raw Normal View History

2023-03-17 16:20:25 +05:30
# frozen_string_literal: true
module Gitlab
module Redis
class RepositoryCache < ::Gitlab::Redis::Wrapper
2023-05-27 22:25:52 +05:30
# We create a subclass only for the purpose of differentiating between different stores in cache metrics
RepositoryCacheStore = Class.new(ActiveSupport::Cache::RedisCacheStore)
2023-03-17 16:20:25 +05:30
class << self
# The data we store on RepositoryCache used to be stored on Cache.
def config_fallback
Cache
end
def cache_store
2023-05-27 22:25:52 +05:30
@cache_store ||= RepositoryCacheStore.new(
2023-03-17 16:20:25 +05:30
redis: pool,
compress: Gitlab::Utils.to_boolean(ENV.fetch('ENABLE_REDIS_CACHE_COMPRESSION', '1')),
namespace: Cache::CACHE_NAMESPACE,
2023-05-27 22:25:52 +05:30
expires_in: Cache.default_ttl_seconds
2023-03-17 16:20:25 +05:30
)
end
end
end
end
end