作者 邓超

统计缓存

@@ -447,7 +447,7 @@ class MailListV2Es2 extends Base { @@ -447,7 +447,7 @@ class MailListV2Es2 extends Base {
447 $body['query']['bool']['must'][] = ['term'=>['folder_as_int'=>folder2int($folder)]]; 447 $body['query']['bool']['must'][] = ['term'=>['folder_as_int'=>folder2int($folder)]];
448 if($this->assignSql($folder)) $body['query']['bool']['must'][] = $this->assignSql($folder); 448 if($this->assignSql($folder)) $body['query']['bool']['must'][] = $this->assignSql($folder);
449 // logs('count :'.json_encode($body)); 449 // logs('count :'.json_encode($body));
450 - if(app()->request('nocache')!='web'){ 450 + if(app()->request('nocache')!='web' || $folder=='垃圾箱' || $folder == '发件箱'){
451 $key = 'count:'.date('Ymd').md5(json_encode($body)); 451 $key = 'count:'.date('Ymd').md5(json_encode($body));
452 $a = redis()->get($key); 452 $a = redis()->get($key);
453 if(!is_numeric($a)){ 453 if(!is_numeric($a)){
@@ -474,11 +474,11 @@ class MailListV2Es2 extends Base { @@ -474,11 +474,11 @@ class MailListV2Es2 extends Base {
474 $body['query']['bool']['must'][] = $this->assignSql('收件箱'); 474 $body['query']['bool']['must'][] = $this->assignSql('收件箱');
475 475
476 if(app()->request('nocache')!='web'){ 476 if(app()->request('nocache')!='web'){
477 - $key = 'flagged_count:'.date('Ymd').md5(json_encode($body)); 477 + $key = 'flagged_count:'.md5(json_encode($body));
478 $a = redis()->get($key); 478 $a = redis()->get($key);
479 if(!is_numeric($a)){ 479 if(!is_numeric($a)){
480 $a = $this->es->count($body); 480 $a = $this->es->count($body);
481 - redis()->set($key,$a,strtotime(date('Y-m-d',strtotime("+1 day"))) - time()); 481 + redis()->set($key,$a,3600);
482 } 482 }
483 return $a; 483 return $a;
484 } 484 }