Last active
December 20, 2015 15:39
-
-
Save rodrigodiez/6156330 to your computer and use it in GitHub Desktop.
Redis flood control
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Primer intento 10:00 AM | |
> SETEX users:1:comments:attempts:27664A7l 300 fooValue | |
// Segundo intento 10:01 AM | |
> SETEX users:1:comments:attempts:lh70Qnvh 300 fooValue | |
// Tercer intento 10:02 AM | |
> SETEX users:1:comments:attempts:f2F5mNjl 300 fooValue | |
// 10:03 AM. Tenemos tres claves diferentes | |
> KEYS users:1:comments:attempts:* | |
1) "users:1:comments:attempts:27664A7l" | |
2) "users:1:comments:attempts:lh70Qnvh" | |
3) "users:1:comments:attempts:f2F5mNjl" | |
// 10:05 AM La primera de ellas ha caducado | |
> KEYS users:1:comments:attempts:* | |
1) "users:1:comments:attempts:lh70Qnvh" | |
2) "users:1:comments:attempts:f2F5mNjl" | |
// 10:07 Todas han caducado | |
> KEYS users:1:comments:attempts:* | |
(empty list or set) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Not sure you should use KEYS in large productions...