Upgrade to Pro — share decks privately, control downloads, hide ads and more …

레디스로 간단한 랭킹

레디스로 간단한 랭킹

sorted set을 쓰시면 됩니다

8e55bdaf5aab4b03ea9581da632a9dcd?s=128

Han Jin-Soo

March 19, 2016
Tweet

Transcript

  1. ۨ٣झ۽ рױೠ ۘఊ ٜ݅ӝ ೠ૓ࣻ

  2. None
  3. in-memory data structure store

  4. https://github.com/antirez/redis-io

  5. Cluster Connection Geo Hashes HyperLogLog Keys Lists Pub/Sub Scripting Server


    Sorted Sets Strings Transactions ׮নೠ Groupٜ
  6. Cluster Connection Geo Hashes HyperLogLog Keys Lists Pub/Sub Scripting Server


    Sorted Sets Strings Transactions ׮নೠ Groupٜ
  7. None
  8. None
  9. ؘ੉ఠ ֍ӝ 127.0.0.1:6379> zadd ranking 9999999 a (integer) 1 127.0.0.1:6379>

    zadd ranking 8888888 b (integer) 1 127.0.0.1:6379> zadd ranking 7777777 c (integer) 1
  10. ؘ੉ఠ ഛੋ 127.0.0.1:6379> zrange ranking 0 -1 withscores

  11. ؘ੉ఠ ഛੋ 127.0.0.1:6379> zrange ranking 0 -1 withscores 1) "c"

    2) "7777777" 3) "b" 4) "8888888" 5) "a" 6) "9999999"
  12. ؘ੉ఠ ഛੋ 127.0.0.1:6379> zrank ranking a (integer) 2 127.0.0.1:6379> zrank

    ranking b (integer) 1 127.0.0.1:6379> zrank ranking c (integer) 0
  13. ؘ੉ఠ ഛੋ 1١ => 0 2١ => 1 3١ =>

    2 127.0.0.1:6379> zrank ranking a (integer) 2 127.0.0.1:6379> zrank ranking b (integer) 1 127.0.0.1:6379> zrank ranking c (integer) 0
  14. ؘ੉ఠ ഛੋ 1١ => 0 2١ => 1 3١ =>

    2 127.0.0.1:6379> zrank ranking a (integer) 2 127.0.0.1:6379> zrank ranking b (integer) 1 127.0.0.1:6379> zrank ranking c (integer) 0 a b c
  15. Q. ੼ࣻо ઁੌ ֫਷ গо 1١ ೮ਵݶ જѷযਃ

  16. Q. ੼ࣻо ઁੌ ֫਷ গо 1١ ೮ਵݶ જѷযਃ 127.0.0.1:6379> zrevrank

    ranking a (integer) 0 127.0.0.1:6379> zrevrank ranking b (integer) 1 127.0.0.1:6379> zrevrank ranking c (integer) 2
  17. Q. ੼ࣻо ઁੌ ֫਷ গо 1١ ೮ਵݶ જѷযਃ 127.0.0.1:6379> zrevrank

    ranking a (integer) 0 127.0.0.1:6379> zrevrank ranking b (integer) 1 127.0.0.1:6379> zrevrank ranking c (integer) 2 a b c
  18. Q. rankingী ਬ੷ ੼ࣻо হחؘ ؀୽੉ۄب ١ࣻо ঌҊ रযਃ

  19. Q. rankingী ਬ੷ ੼ࣻо হחؘ ؀୽੉ۄب ١ࣻо ঌҊ रযਃ 127.0.0.1:6379>

    zrangebyscore ranking 6666666 8888888 1) "c" 2) "b"
  20. Q. rankingী ਬ੷ ੼ࣻо হחؘ ؀୽੉ۄب ١ࣻо ঌҊ रযਃ 127.0.0.1:6379>

    zrangebyscore ranking 6666666 8888888 1) "c" 2) "b" 127.0.0.1:6379> zrangebyscore ranking 6666666 8888888 limit 0 1 1) "c"
  21. ױ੼ ؘ੉ఠо ޷ܻ ׮ ऺৈ ੓যঠ݅ ۘఊਸ ҳೡ ࣻ ੓׮.

    (഑਷ ਬ୶ೡ ࣻ ੓׮)
  22. ױ੼ ؘ੉ఠо ޷ܻ ׮ ऺৈ ੓যঠ݅ ۘఊਸ ҳೡ ࣻ ੓׮.

    (഑਷ ਬ୶ೡ ࣻ ੓׮) ੢੼ ۘఊ दझమਸ ই઱ औѱ ڣٯ ҳഅೡ ࣻ ੓׮.
  23. ױ੼ ؘ੉ఠо ޷ܻ ׮ ऺৈ ੓যঠ݅ ۘఊਸ ҳೡ ࣻ ੓׮.

    (഑਷ ਬ୶ೡ ࣻ ੓׮) ੢੼ ۘఊ दझమਸ ই઱ औѱ ڣٯ ҳഅೡ ࣻ ੓׮. য٣ী ॳݶ જਸө ѱ੐ ۘఊ दझమ ਺ঈ ࣽਤ