mirror of
https://github.com/SophiaAtkinson/steamwidgets-web.git
synced 2025-06-27 06:07:40 -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)
|
public static function cachedSteamApp($appid, $lang)
|
||||||
{
|
{
|
||||||
$cache_driver = env('CACHE_DRIVER', null);
|
$cache = config('cache');
|
||||||
$cache_duration = env('CACHE_DURATION', 123);
|
|
||||||
|
if ($cache->driver === 'db') {
|
||||||
if ($cache_driver === 'db') {
|
return json_decode(CacheModel::remember('steam_app_' . $appid . '_' . $lang, $cache->duration, function() use ($appid, $lang) {
|
||||||
return json_decode(CacheModel::remember('steam_app_' . $appid . '_' . $lang, $cache_duration, function() use ($appid, $lang) {
|
|
||||||
return json_encode(SteamApp::querySteamData($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.');
|
throw new \Exception('Not implemented yet.');
|
||||||
} else {
|
} else {
|
||||||
return SteamApp::querySteamData($appid, $lang);
|
return SteamApp::querySteamData($appid, $lang);
|
||||||
|
Reference in New Issue
Block a user