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

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

module Gitlab
  module Redis
    class RateLimiting < ::Gitlab::Redis::Wrapper
      # We create a subclass only for the purpose of differentiating between different stores in cache metrics
      RateLimitingStore = Class.new(ActiveSupport::Cache::RedisCacheStore)

      class << self
        # The data we store on RateLimiting used to be stored on Cache.
        def config_fallback
          Cache
        end

        def cache_store
          @cache_store ||= RateLimitingStore.new(redis: pool, namespace: Cache::CACHE_NAMESPACE)
        end
      end
    end
  end
end