我正在尝试重新设置缓存,但每次执行此操作时,到期时间都会保持活动状态。如何在不影响到期时间的情况下更新redis缓存。
$cache = Yii::app()->cache;
if($cache->get($md5)){
$md5Values = $cache->get($md5);
$md5Values['repetition'] +=1;
$md5Values['priority'] = 2;var_dump($cache->get($md5));
$cache->set($md5,$md5Values);
if ($md5Values['repetition'] > 10 && $md5Values['repetition'] <= 1000){
$md5Values['priority'] = 1;
$cache->set($md5,$md5Values);
var_dump($cache->get($md5));
return array('priority'=>1);
} elseif ($md5Values['repetition'] > 1000){
$md5Values['priority'] = 0;
$cache->set($md5,$md5Values);
return array('priority'=>0);
}
return false;
}else{
$cacheArray=array();
$cacheArray['repetition'] = 1;
$cacheArray['priority'] = 2;
$cache->set($md5,$cacheArray,30);
return false;
}