Created
October 10, 2016 17:23
-
-
Save dvirsky/3c4f4ebd480fc58874a74ce47dd0f059 to your computer and use it in GitHub Desktop.
This file contains 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
not connected> IDX.CREATE users TYPE HASH SCHEMA tm TIME | |
OK | |
127.0.0.1:6379> IDX.INTO users HMSET user1 tm 1476119602 | |
(integer) 1 | |
127.0.0.1:6379> IDX.INTO users HMSET user2 tm 1476019602 | |
(integer) 1 | |
127.0.0.1:6379> IDX.FROM users WHERE "tm < NOW" HGETALL $ | |
1) user2 | |
2) 1) "tm" | |
2) "1476019602" | |
3) user1 | |
4) 1) "tm" | |
2) "1476119602" | |
127.0.0.1:6379> IDX.FROM users WHERE "tm < TIME_SUB(NOW, DAYS(10))" HGETALL $ | |
(empty list or set) | |
127.0.0.1:6379> IDX.FROM users WHERE "tm < TIME_SUB(NOW, DAYS(1))" HGETALL $ | |
1) user2 | |
2) 1) "tm" | |
2) "1476019602" | |
127.0.0.1:6379> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment