当前位置:网站首页>Redis uses sorted set to cache latest comments
Redis uses sorted set to cache latest comments
2022-07-31 03:31:00 【Mar, fleeting】
Article table of contents
Foreword
sorted set is an ordered set.The attribute of weight is provided, and data can be obtained according to the weight.
implemented
Assuming that there are reviews 11, 22, 33, 44, 55 for product A now, the weights are accumulated from 1 (+1) according to the order of reviews.
zadd a_comments 1 11zadd a_comments 2 22zadd a_comments 3 33zadd a_comments 4 44zadd a_comments 5 55A new comment 66 was generated at this time.Determine the weight of comment 66 (total + 1)
# Get the total number of 5 and determine the weight of 6zcard a_comments# add to rediszadd a_comments 6 66View the latest comments, 2 records per page.
# Get the current amountzcard a_comments# First page 55,66zrangebyscore a_comments 5 6# 2nd page 33,44zrangebyscore a_comments 3 4# 3rd page 11,22zrangebyscore a_comments 1 2边栏推荐
- $parent/$children 与 ref
- 【AUTOSAR-RTE】-4-Port和Interface以及Data Type
- 测试中的误报和漏报同样的值得反复修正
- LeetCode简单题之两个数组间的距离值
- A brief introduction to the CheckboxListTile component of the basic components of Flutter
- Know the showTimePicker method of the basic components of Flutter
- errno错误码及含义(中文)
- 从滴滴罚款后数据治理思考
- WebSocket Session is null
- 选好冒烟测试用例,为进入QA的制品包把好第一道关
猜你喜欢

7年经验,功能测试工程师该如何一步步提升自己的能力呢?

What is a system?

浅识Flutter 基本组件之showDatePicker方法

Ambiguous method call.both

Daily practice of LeetCode - palindrome structure of OR36 linked list

组件传值 provide/inject
![[C language] General method for finding the sum of the greatest common factor and the least common multiple of two integers m and n, the classical solution](/img/60/fa75e06af4d143ee3fb493221fa3d9.jpg)
[C language] General method for finding the sum of the greatest common factor and the least common multiple of two integers m and n, the classical solution

TCP详解(二)

递归查询单表-单表树结构-(自用)

Detailed explanation of TCP (1)
随机推荐
LeetCode每日一练 —— 138. 复制带随机指针的链表
PMP WeChat group daily exercises
SQL injection Less46 (injection after order by + rand() Boolean blind injection)
Difference between unallocated blocks and unused blocks in database files
遗留系统的自动化策略
SonarQube的BUG定义
安全20220715
Web container and IIS --- Middleware penetration method 1
Golang中的addressable
Mysql 45讲学习笔记(二十三)MYSQL怎么保证数据不丢
解析小结—自用
STM32问题合集
端口排查步骤-7680端口分析-Dosvc服务
组件传值 provide/inject
IDEA常用快捷键与插件
Mysql 45讲学习笔记(二十五)MYSQL保证高可用
【编译原理】递归下降语法分析设计原理与实现
Distributed locks and three implementation methods
7年经验,功能测试工程师该如何一步步提升自己的能力呢?
【异常】The field file exceeds its maximum permitted size of 1048576 bytes.