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

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

22 lines
607 B
Ruby
Raw Normal View History

2021-11-18 22:05:49 +05:30
# frozen_string_literal: true
module Gitlab
module Redis
class RateLimiting < ::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
RateLimitingStore = Class.new(ActiveSupport::Cache::RedisCacheStore)
2023-04-23 21:23:45 +05:30
class << self
# The data we store on RateLimiting used to be stored on Cache.
def config_fallback
Cache
end
def cache_store
2023-05-27 22:25:52 +05:30
@cache_store ||= RateLimitingStore.new(redis: pool, namespace: Cache::CACHE_NAMESPACE)
2023-04-23 21:23:45 +05:30
end
2021-11-18 22:05:49 +05:30
end
end
end
end