Changed calls to the Cache to use DateTime instances instead of integers representing minutes as 5.8 changed integers into meaning seconds instead.

This commit is contained in:
Luke Towers 2019-06-12 02:33:26 -06:00
parent 1e3edae81a
commit 1aff1e0a1e
7 changed files with 16 additions and 8 deletions

View File

@ -322,7 +322,8 @@ class CmsCompoundObject extends CmsObject
self::$objectComponentPropertyMap = $objectComponentMap;
Cache::put($key, base64_encode(serialize($objectComponentMap)), Config::get('cms.parsedPageCacheTTL', 10));
$expiresAt = now()->addMinutes(Config::get('cms.parsedPageCacheTTL', 10));
Cache::put($key, base64_encode(serialize($objectComponentMap)), $expiresAt);
if (array_key_exists($componentName, $objectComponentMap[$objectCode])) {
return $objectComponentMap[$objectCode][$componentName];

View File

@ -222,7 +222,8 @@ class CodeParser
$cached = $this->getCachedInfo() ?: [];
$cached[$this->filePath] = $cacheItem;
Cache::put($this->dataCacheKey, base64_encode(serialize($cached)), 1440);
$expiresAt = now()->addMinutes(1440);
Cache::put($this->dataCacheKey, base64_encode(serialize($cached)), $expiresAt);
self::$cache[$this->filePath] = $result;
}

View File

@ -127,10 +127,11 @@ class Router
: $fileName;
$key = $this->getUrlListCacheKey();
$expiresAt = now()->addMinutes(Config::get('cms.urlCacheTtl', 1));
Cache::put(
$key,
base64_encode(serialize($urlList)),
Config::get('cms.urlCacheTtl', 1)
$expiresAt
);
}
}
@ -251,7 +252,8 @@ class Router
$this->urlMap = $map;
if ($cacheable) {
Cache::put($key, base64_encode(serialize($map)), Config::get('cms.urlCacheTtl', 1));
$expiresAt = now()->addMinutes(Config::get('cms.urlCacheTtl', 1));
Cache::put($key, base64_encode(serialize($map)), $expiresAt);
}
return false;

View File

@ -155,7 +155,8 @@ class Theme
if (App::hasDatabase()) {
try {
try {
$dbResult = Cache::remember(self::ACTIVE_KEY, 1440, function () {
$expiresAt = now()->addMinutes(1440);
$dbResult = Cache::remember(self::ACTIVE_KEY, $expiresAt, function () {
return Parameter::applyKey(self::ACTIVE_KEY)->value('value');
});
}

View File

@ -190,7 +190,8 @@ trait UrlMaker
'mtime' => @File::lastModified($filePath)
];
Cache::put($key, serialize($cached), Config::get('cms.parsedPageCacheTTL', 1440));
$expiresAt = now()->addMinutes(Config::get('cms.parsedPageCacheTTL', 1440));
Cache::put($key, serialize($cached), $expiresAt);
return static::$urlPageName = $baseFileName;
}

View File

@ -134,10 +134,11 @@ class MediaLibrary
$folderContents = $this->scanFolderContents($fullFolderPath);
$cached[$fullFolderPath] = $folderContents;
$expiresAt = now()->addMinutes(Config::get('cms.storage.media.ttl', 10));
Cache::put(
$this->cacheKey,
base64_encode(serialize($cached)),
Config::get('cms.storage.media.ttl', 10)
$expiresAt
);
}

View File

@ -703,7 +703,8 @@ class UpdateManager
}
$data = $this->requestServerData($type.'/popular');
Cache::put($cacheKey, base64_encode(serialize($data)), 60);
$expiresAt = now()->addMinutes(60);
Cache::put($cacheKey, base64_encode(serialize($data)), $expiresAt);
foreach ($data as $product) {
$code = array_get($product, 'code', -1);