Class: Gitlab::RackAttack::InstrumentedCacheStore

Inherits:
Object
  • Object
show all
Defined in:
lib/gitlab/rack_attack/instrumented_cache_store.rb

Overview

This class is a proxy for all Redis calls made by RackAttack. All the calls are instrumented, then redirected to the underlying store (in `.store). This class instruments the standard interfaces of ActiveRecord::Cache defined in github.com/rails/rails/blob/v6.0.3.1/activesupport/lib/active_support/cache.rb#L315

For more information, please see gitlab.com/gitlab-com/gl-infra/scalability/-/issues/751

Constant Summary collapse

NOTIFICATION_CHANNEL =
'redis.rack_attack'

Instance Method Summary collapse

Constructor Details

#initialize(upstream_store: ::Gitlab::Redis::RateLimiting.cache_store, notifier: ActiveSupport::Notifications) ⇒ InstrumentedCacheStore

Returns a new instance of InstrumentedCacheStore.


18
19
20
21
# File 'lib/gitlab/rack_attack/instrumented_cache_store.rb', line 18

def initialize(upstream_store: ::Gitlab::Redis::RateLimiting.cache_store, notifier: ActiveSupport::Notifications)
  @upstream_store = upstream_store
  @notifier = notifier
end