Skip to content

Conversation

@ankitd009
Copy link

@ankitd009 ankitd009 commented Aug 11, 2019

Avoid making an extra Get call to read counter's value, use the incremented value returned by INCR operation.

Testing Strategy: existing tests for rate limit should pass.

c.Send("MULTI")
c.Send("INCR", "foo")
c.Send("EXPIRE", "foo", 300)
r, err := c.Do("EXEC")
// prints [1, 1]
// r[0] result of incr operation
// r[1 ] result of expire, 1 if the timeout was set, 0 if key does not exist.
fmt.Println(r) 

Redis-Expire Doc
Redigo-Pipeline Doc

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant