Created by CyanHall.com on 04/30/2021
๐Ÿ‘‰ย ย github shields Star me if itโ€™s helpful.

1. List all Database

    INFO keyspace
  

2. Select Database

    SELECT 7
  

3. List all keys

    KEYS *
  

4. Delete key

    DEL NAME
  

5. sorted set

    # ๅ‘ๆœ‰ๅบ้›†ๅˆๆทปๅŠ ไธ€ไธชๆˆ–ๅคšไธชๆˆๅ‘˜
ZADD [RANK_KEY] [score] [member]

# ่ฟ”ๅ›žๆœ‰ๅบ้›†ๅˆไธญๆŒ‡ๅฎšๆˆๅ‘˜็š„ๆŽ’ๅ๏ผŒๆœ‰ๅบ้›†ๆˆๅ‘˜ๆŒ‰ๅˆ†ๆ•ฐๅ€ผ้€’ๅ‡(ไปŽๅคงๅˆฐๅฐ)ๆŽ’ๅบ
ZREVRANK [RANK_KEY] [member]
  

6. sorted set in Python

    user_id = 1
score = 2
redis_client.zadd('RANK_KEY', {
  f"u_{user_id}": score
})
redis_client.zrevrank('RANK_KEY', f"u_{user_id}")
  

1. List all Database

    INFO keyspace
  

3. List all keys

    KEYS *
  

5. sorted set

    # ๅ‘ๆœ‰ๅบ้›†ๅˆๆทปๅŠ ไธ€ไธชๆˆ–ๅคšไธชๆˆๅ‘˜
ZADD [RANK_KEY] [score] [member]

# ่ฟ”ๅ›žๆœ‰ๅบ้›†ๅˆไธญๆŒ‡ๅฎšๆˆๅ‘˜็š„ๆŽ’ๅ๏ผŒๆœ‰ๅบ้›†ๆˆๅ‘˜ๆŒ‰ๅˆ†ๆ•ฐๅ€ผ้€’ๅ‡(ไปŽๅคงๅˆฐๅฐ)ๆŽ’ๅบ
ZREVRANK [RANK_KEY] [member]
  

2. Select Database

    SELECT 7
  

4. Delete key

    DEL NAME
  

6. sorted set in Python

    user_id = 1
score = 2
redis_client.zadd('RANK_KEY', {
  f"u_{user_id}": score
})
redis_client.zrevrank('RANK_KEY', f"u_{user_id}")
  


Maitained byย Cyanhall.com, Copy Rights @ CC BY-NC-SA 4.0 ย  ย  ExcelRoadMap