作者 邓超

统计缓存

... ... @@ -447,8 +447,8 @@ class MailListV2Es2 extends Base {
$body['query']['bool']['must'][] = ['term'=>['folder_as_int'=>folder2int($folder)]];
if($this->assignSql($folder)) $body['query']['bool']['must'][] = $this->assignSql($folder);
// logs('count :'.json_encode($body));
if($folder=='垃圾箱'){
$key = 'laji_count:'.md5(json_encode($body));
if(app()->request('nocache')!='web'){
$key = 'count:'.date('Ymd').md5(json_encode($body));
$a = redis()->get($key);
if(!is_numeric($a)){
$a = $this->es->count($body);
... ... @@ -472,6 +472,17 @@ class MailListV2Es2 extends Base {
if($this->assignSql('收件箱'))
$body['query']['bool']['must'][] = $this->assignSql('收件箱');
if(app()->request('nocache')!='web'){
$key = 'flagged_count:'.date('Ymd').md5(json_encode($body));
$a = redis()->get($key);
if(!is_numeric($a)){
$a = $this->es->count($body);
redis()->set($key,$a,strtotime(date('Y-m-d',strtotime("+1 day"))) - time());
}
return $a;
}
return $this->es->count($body);
}
... ...