Class: ActionLimiter::Config
- Inherits:
-
Object
- Object
- ActionLimiter::Config
- Includes:
- Singleton
- Defined in:
- lib/action_limiter/config.rb
Overview
Provides configuration for the Gem
Instance Attribute Summary collapse
-
#redis ⇒ Object
The shared Redis connection pool.
-
#redis_url ⇒ Object
The URL used for new Redis connections in the default pool.
Instance Method Summary collapse
-
#initialize ⇒ Config
constructor
A new instance of Config.
Constructor Details
#initialize ⇒ Config
Returns a new instance of Config.
26 27 28 29 30 31 32 33 |
# File 'lib/action_limiter/config.rb', line 26 def initialize pool_size = ENV.fetch('RAILS_MAX_THREADS', 1).to_i self.redis_url = 'redis://localhost:6379/0' self.redis = ConnectionPool.new(size: pool_size) do Redis.new(url: redis_url) end end |
Instance Attribute Details
#redis ⇒ Object
The shared Redis connection pool
18 19 20 |
# File 'lib/action_limiter/config.rb', line 18 def redis @redis end |
#redis_url ⇒ Object
The URL used for new Redis connections in the default pool
22 23 24 |
# File 'lib/action_limiter/config.rb', line 22 def redis_url @redis_url end |