Welcome to mirror list, hosted at ThFree Co, Russian Federation.

feature_flag.rb « redis « gitlab « lib - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 441ff66903504bc64cf1d13aa13a70c5f3e7abda (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# frozen_string_literal: true

module Gitlab
  module Redis
    class FeatureFlag < ::Gitlab::Redis::Wrapper
      FeatureFlagStore = Class.new(ActiveSupport::Cache::RedisCacheStore)

      class << self
        # The data we store on FeatureFlag is currently stored on Cache.
        def config_fallback
          Cache
        end

        def cache_store
          @cache_store ||= FeatureFlagStore.new(
            redis: pool,
            compress: Gitlab::Utils.to_boolean(ENV.fetch('ENABLE_REDIS_CACHE_COMPRESSION', '1')),
            namespace: Cache::CACHE_NAMESPACE,
            expires_in: 1.hour
          )
        end
      end
    end
  end
end