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

base_strategy.rb « application_rate_limiter « gitlab « lib - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: b97770c0524401c7063e8a716c0e01bbc4cd8476 (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
# frozen_string_literal: true

module Gitlab
  module ApplicationRateLimiter
    class BaseStrategy
      # Increment the rate limit count and return the new count value
      def increment(cache_key, expiry)
        raise NotImplementedError
      end

      # Return the rate limit count.
      # Should be 0 if there is no data in the cache.
      def read(cache_key)
        raise NotImplementedError
      end

      private

      def with_redis(&block)
        ::Gitlab::Redis::RateLimiting.with(&block) # rubocop: disable CodeReuse/ActiveRecord
      end
    end
  end
end