数据库 – 你如何获得最后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 (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |