Class: StandardId::RateLimitStore
- Inherits:
-
Object
- Object
- StandardId::RateLimitStore
- Defined in:
- lib/standard_id/rate_limit_store.rb
Overview
A delegating cache store for rate limiting that lazily resolves the backing store at request time. This allows the engine’s rate_limit declarations to work regardless of boot order, and respects the host app’s cache configuration.
Resolution order:
1. StandardId.config.cache_store (if it responds to :increment)
2. Rails.cache
Instance Method Summary collapse
- #clear(**options) ⇒ Object
- #delete(name, **options) ⇒ Object
- #increment(name, amount = 1, **options) ⇒ Object
- #read(name, **options) ⇒ Object
- #write(name, value, **options) ⇒ Object
Instance Method Details
#clear(**options) ⇒ Object
27 28 29 |
# File 'lib/standard_id/rate_limit_store.rb', line 27 def clear(**) resolve_store.clear(**) end |
#delete(name, **options) ⇒ Object
23 24 25 |
# File 'lib/standard_id/rate_limit_store.rb', line 23 def delete(name, **) resolve_store.delete(name, **) end |
#increment(name, amount = 1, **options) ⇒ Object
11 12 13 |
# File 'lib/standard_id/rate_limit_store.rb', line 11 def increment(name, amount = 1, **) resolve_store.increment(name, amount, **) end |
#read(name, **options) ⇒ Object
15 16 17 |
# File 'lib/standard_id/rate_limit_store.rb', line 15 def read(name, **) resolve_store.read(name, **) end |
#write(name, value, **options) ⇒ Object
19 20 21 |
# File 'lib/standard_id/rate_limit_store.rb', line 19 def write(name, value, **) resolve_store.write(name, value, **) end |