Bläddra i källkod

缓存BUG调整

LD 5 år sedan
förälder
incheckning
b4c80238f0
3 ändrade filer med 2 tillägg och 3 borttagningar
  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