mirror of
https://github.com/SophiaAtkinson/steamwidgets-web.git
synced 2025-06-26 17:17:42 -07:00
Cache config
This commit is contained in:
6
app/config/cache.php
Normal file
6
app/config/cache.php
Normal file
@ -0,0 +1,6 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
'driver' => env('CACHE_DRIVER', null),
|
||||
'duration' => env('CACHE_DURATION', 123)
|
||||
];
|
@ -13,14 +13,13 @@ class SteamCache {
|
||||
*/
|
||||
public static function cachedSteamApp($appid, $lang)
|
||||
{
|
||||
$cache_driver = env('CACHE_DRIVER', null);
|
||||
$cache_duration = env('CACHE_DURATION', 123);
|
||||
|
||||
if ($cache_driver === 'db') {
|
||||
return json_decode(CacheModel::remember('steam_app_' . $appid . '_' . $lang, $cache_duration, function() use ($appid, $lang) {
|
||||
$cache = config('cache');
|
||||
|
||||
if ($cache->driver === 'db') {
|
||||
return json_decode(CacheModel::remember('steam_app_' . $appid . '_' . $lang, $cache->duration, function() use ($appid, $lang) {
|
||||
return json_encode(SteamApp::querySteamData($appid, $lang));
|
||||
}));
|
||||
} else if ($cache_driver === 'redis') {
|
||||
} else if ($cache->driver === 'redis') {
|
||||
throw new \Exception('Not implemented yet.');
|
||||
} else {
|
||||
return SteamApp::querySteamData($appid, $lang);
|
||||
|
Reference in New Issue
Block a user