webman的Redis扩展无法设置过期时间?

Mr_Deng

截图
如图,redis版本是phpstudy下载的
截图

2717 2 1
2个回答

Mr_Deng

我知道了,有个expire方法,和原始操作不一样

  • 暂无评论
小阳光

在依赖是 "illuminate/redis": "^7.26"的情况下

文档是有问题的,第三个参数不是 timeout
$userInfo = Redis::set('test','mytest','EX',10);这样才对,这样设置过期时间是10秒

下面是对的
public function set($key, $value, $expireResolution = null, $expireTTL = null, $flag = null)

第一个参数 和第二个参数不用讲

expireResolution 是过期策略,比如
EX seconds -- Set the specified expire time, in seconds. 秒
PX milliseconds -- Set the specified expire time, in milliseconds. 毫秒
NX -- Only set the key if it does not already exist. 不存在则设置
XX -- Only set the key if it already exist. 存在则设置

第四个参数是
expireTTL 过期时间

  • Mr_Deng 2020-09-06

    确实如此,请问文档在哪里能看到?

  • 小阳光 2020-09-06

    \webman\support\bootstrap\Redis.php 中的 * @method static bool set 参数有问题,给人误解

  • walkor 2020-09-07

    感谢反馈,文档已经修复

年代过于久远,无法发表回答
🔝