Class: Ihasa::Bucket::LegacyImplementation
- Inherits:
-
Object
- Object
- Ihasa::Bucket::LegacyImplementation
- Includes:
- Singleton
- Defined in:
- lib/ihasa/bucket/legacy_implementation.rb
Overview
For redis server whose version is prior to 3.2
Instance Method Summary collapse
Instance Method Details
#accept?(bucket) ⇒ Boolean
19 20 21 22 23 |
# File 'lib/ihasa/bucket/legacy_implementation.rb', line 19 def accept?(bucket) now = redis_time bucket.redis script = Lua.token_bucket_algorithm_legacy(now) bucket.redis.eval(script, bucket.keys) end |
#save(bucket) ⇒ Object
8 9 10 11 12 13 14 15 16 17 |
# File 'lib/ihasa/bucket/legacy_implementation.rb', line 8 def save(bucket) bucket.redis.eval( Lua.configuration( bucket.rate, bucket.burst, Lua.now_declaration(redis_time(bucket.redis)) ), bucket.keys ) end |