加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 站长学院 > MsSql教程 > 正文

数据库 – 你如何获得最后10个键redis?

发布时间:2020-12-12 16:36:53 所属栏目:MsSql教程 来源:网络整理
导读:假设我有一个具有1,000,000个密钥的数据库.有没有办法知道该数据库中的最后10个密钥? 解决方法 您将需要使用以下命令将其维护为另一个列表. Add new key to the front of the list LPUSH last10keys keyRetain only the last 10LTRIM last10keys 0 9Get the
假设我有一个具有1,000,000个密钥的数据库.有没有办法知道该数据库中的最后10个密钥?

解决方法

您将需要使用以下命令将其维护为另一个列表.
Add new key to the front of the list  
LPUSH last10keys key

Retain only the last 10
LTRIM last10keys 0 9

Get the last keys - will return 10 or less
LRANGE mylist 0 9

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读