redis中如何给incr加过期时间

redis我们经常用到incr,那么如何给incr设置过期时间呢
>$today = date('Ymd');
$cacheKey = "withdraw".$today;
if(Cache::store('redis')->has($cacheKey)){
Cache::store('redis')->inc($cacheKey);
}else{
$expire = strtotime(date("Y-m-d",strtotime("+2 day"))) - time();
Cache::store('redis')->set($cacheKey,1,$expire);
}

    A+
发布日期:2021年12月18日  所属分类:未分类

发表评论

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: