作者 邓超

x

... ... @@ -41,7 +41,10 @@ trait RedisQuery {
public function get($key, $default=null)
{
$data = $this->getClient()->get($key);
if($data === null){
if($data === false){
if($default instanceof \Closure){
return $default();
}
return $default;
}
return $this->unserialize($data);
... ...
... ... @@ -286,7 +286,16 @@ class SyncMail {
$p++;
foreach ($uids as $k=>$uid){
if($this->db->cache(86400*30,false)->value(listsSql::first(dbWhere(['email_id'=>$this->emailId(),'folder_id'=>$folder_id,'uid'=>$uid]),'count(*) as c'))){
$has = redis()->get('h_'.$folder_id.'_'.$uid,function () use ($folder_id,$uid){
$num = $this->db->value(listsSql::first(dbWhere(['email_id'=>$this->emailId(),'folder_id'=>$folder_id,'uid'=>$uid]),'count(*) as c'));
if($num){
redis()->set('h_'.$folder_id.'_'.$uid,1,86400);
}
return $num;
});
if($has){
unset($uids[$k]);
}
}
... ...