瀏覽代碼

缓存BUG调整

LD 5 年之前
父節點
當前提交
b4c80238f0
共有 3 個文件被更改,包括 2 次插入3 次删除
  1. 1 0
      app/Services/CacheService.php
  2. 1 1
      app/Services/LogisticService.php
  3. 0 2
      tests/Unit/EchoTest.php

+ 1 - 0
app/Services/CacheService.php

@@ -9,6 +9,7 @@ use Illuminate\Support\Facades\Cache;
 class CacheService
 {
     function getOrExecute(String $key, $func, $expiration=null){
+        if(!$expiration) $expiration=config('cache.expirations.default');
         return Cache::remember($key, $expiration, $func);
 //        $results = Cache::get($key);
 //        if(!$results){

+ 1 - 1
app/Services/LogisticService.php

@@ -24,7 +24,7 @@ Class LogisticService
                 $query->where("type",$type)->orWhere("type","全部");
             });
             return $query->get();
-        },config('cache.expirations.persistent'));
+        },config('cache.expirations.rarelyChange'));
     }
 
     public function firstOrCreate(array $params, array $values = null){

+ 0 - 2
tests/Unit/EchoTest.php

@@ -2,8 +2,6 @@
 
 namespace Tests\Unit;
 
-use App\Services\CacheService;
-use Illuminate\Support\Facades\Cache;
 use Tests\TestCase;
 
 class EchoTest extends TestCase