Skip to content

Instantly share code, notes, and snippets.

@dvirsky
Created October 10, 2016 17:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dvirsky/3c4f4ebd480fc58874a74ce47dd0f059 to your computer and use it in GitHub Desktop.
Save dvirsky/3c4f4ebd480fc58874a74ce47dd0f059 to your computer and use it in GitHub Desktop.
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