We are using laravel 5.4 on centos 7.3 and php 5.6
A while back we experinced a lot of cache errors and took advice on serialization/deserialization as per unserialize() [function.unserialize]: Error at offset
Over time we experienced slowdown in the system. Today we started tracking why there's such slowdown and discovered a lot of cache misses.
We thought problem was with file
cache and decided to switch to redis
, as per advice on http://ift.tt/2sYmJ6B. Part of config/cache.php now looks like:
'default' => env('CACHE_DRIVER', 'redis'),
'redis' => [
'driver' => 'redis',
'connection' => 'default',
],
We have a small function to test if cache is being hit:
/**
*
* Test cache
*
**/
public static function cacheTest(){
$cacheKey = 'CACHE-HIT-MISS';
$minutes = 60*24*30*12; // cache for 1 year
$tested = Cache::remember($cacheKey, $minutes, function() {
error_log("cache missed");
return "Cached";
});
return $tested;
}
Ideally we shouldn't get "cache missed" till after a year but for unknown reasons we are always hitting "cache missed".
Any idea?
from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2suVgrF
via IFTTT
Aucun commentaire:
Enregistrer un commentaire