美文网首页C++ 面经
redis常用的数据结构以及在业务中使用的场景

redis常用的数据结构以及在业务中使用的场景

作者: 乔大叶_803e | 来源:发表于2020-04-07 17:43 被阅读0次

常用的数据结构包括:

Redis有很多种数据结构,包括 strings、 hashes、lists、 sets、sorted sets 、 range queries、 bitmaps、 hyperloglogs、geospatial indexes 、 radius queries and streams。常用的有strings、 hashes、lists、 sets、sorted sets

String-字符串

Hash-字典

  • 常用命令
    hget、hset、hgetall等

List -列表

常用命令:
lpush,rpush,lpop,rpop,lrange,BLPOP(阻塞版)等。

Set -集合

Sortset -有序集合


使用的业务场景

在直播系统中,实时排行信息包含直播间在线用户列表,各种礼物排行榜,弹幕消息(可以理解为按消息维度的消息排行榜)等信息,适合使用 Redis 中的 SortedSet 结构进行存储。

相关文章

网友评论

    本文标题:redis常用的数据结构以及在业务中使用的场景

    本文链接:https://www.haomeiwen.com/subject/smnnphtx.html