Redis:使用一个 mset 操作和管道中的一组过期操作或一组在管道中过期的 set 操作 [英] Redis: Using one mset operation with bunch of expire operations in pipeline or bunch of set operation with expiration in pipeline

查看:64
本文介绍了Redis:使用一个 mset 操作和管道中的一组过期操作或一组在管道中过期的 set 操作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在性能方面哪个更好?,A: 用 mset 设置 500 个键,然后 500 个在管道中过期B:500 组也在管道中过期.

In terms of performace which is better?, A: set 500 keys with mset and then 500 expires in a pipeline B: 500 set with expiration in a pipeline too.

谢谢!

推荐答案

MSET 是一个原子操作,当你想要这些键的原子性时使用它们,否则在管道中使用 SETEX.为了性能,你必须测试它们.

MSET is a atomic operation, use them when you want atomicity for those keys, else use SETEX in pipeline. For performance you have to test them.

这篇关于Redis:使用一个 mset 操作和管道中的一组过期操作或一组在管道中过期的 set 操作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆