Browse Source

有效期

wzq 5 years ago
parent
commit
14fdd8321e
1 changed files with 2 additions and 2 deletions
  1. 2 2
      app/Transformers/Post/SuggestTransformer.php

+ 2 - 2
app/Transformers/Post/SuggestTransformer.php

@@ -33,7 +33,6 @@ class SuggestTransformer extends TransformerAbstract
         $comment = [];
         $comment = [];
         $commentKey = 'post_new_comment_'.$post['id'];
         $commentKey = 'post_new_comment_'.$post['id'];
         $commentData = Redis::GET($commentKey);
         $commentData = Redis::GET($commentKey);
-        Redis::del($commentKey);
         if($commentData){
         if($commentData){
             $comment = json_decode($commentData);
             $comment = json_decode($commentData);
         }else{
         }else{
@@ -46,7 +45,8 @@ class SuggestTransformer extends TransformerAbstract
                     'content' => $item->is_delete?'该评论已被删除':$item->content,
                     'content' => $item->is_delete?'该评论已被删除':$item->content,
                 ];
                 ];
             }
             }
-//            Redis::SET($commentKey, json_encode($comment));
+            Redis::SET($commentKey, json_encode($comment));
+            Redis::EXPIRE($commentKey, 300);
         }
         }
 
 
         $isLike = 0;
         $isLike = 0;