作者 邓超

统计缓存

... ... @@ -447,7 +447,7 @@ 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(app()->request('nocache')!='web'){
if(app()->request('nocache')!='web' || $folder=='垃圾箱' || $folder == '发件箱'){
$key = 'count:'.date('Ymd').md5(json_encode($body));
$a = redis()->get($key);
if(!is_numeric($a)){
... ... @@ -474,11 +474,11 @@ class MailListV2Es2 extends Base {
$body['query']['bool']['must'][] = $this->assignSql('收件箱');
if(app()->request('nocache')!='web'){
$key = 'flagged_count:'.date('Ymd').md5(json_encode($body));
$key = 'flagged_count:'.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());
redis()->set($key,$a,3600);
}
return $a;
}
... ...