ejfinneran / ratelimit

A Redis-backed rate limiter written in Ruby
MIT License
260 stars 57 forks source link

Optimize Redis commands #11

Closed lautis closed 10 years ago

lautis commented 10 years ago

Use HMGET to fetch multiple keys from same hash. With HMGET, only one command needs to be sent to Redis.

Replaces MULTI/EXEC with PIPELINE. Pipeline is slightly faster but does not guarantee atomicity of operations. This shouldn't cause any additional concurrency issues as the commands emitted in add do not have any dependency of each other and all clients should emit the same commands.

ejfinneran commented 10 years ago

:+1: Thanks!