diff --git a/app/Models/Setting.php b/app/Models/Setting.php index 9d5b5660..c2e60e43 100644 --- a/app/Models/Setting.php +++ b/app/Models/Setting.php @@ -29,6 +29,8 @@ class Setting extends NexusModel */ public static function get($name = null, $default = null): mixed { + static $settings=null; + if(is_null($settings)) $settings = NexusDB::remember("nexus_settings_in_laravel", 600, function () { return self::getFromDb(); }); diff --git a/include/globalfunctions.php b/include/globalfunctions.php index 49c3f2c7..b60a8095 100644 --- a/include/globalfunctions.php +++ b/include/globalfunctions.php @@ -710,11 +710,13 @@ function get_row_count($table, $suffix = "") function get_user_row($id) { global $Cache, $CURUSER; + static $userRows=[]; static $curuserRowUpdated = false; static $neededColumns = array( 'id', 'noad', 'class', 'enabled', 'privacy', 'avatar', 'signature', 'uploaded', 'downloaded', 'last_access', 'username', 'donor', 'donoruntil', 'leechwarn', 'warned', 'title', 'downloadpos', 'parked', 'clientselect', 'showclienterror', ); + if(isset($userRows[$id]))return $userRows[$id]; $cacheKey = 'user_'.$id.'_content'; $row = \Nexus\Database\NexusDB::remember($cacheKey, 3600, function () use ($id, $neededColumns) { $user = \App\Models\User::query()->with(['wearing_medals'])->find($id, $neededColumns); @@ -751,7 +753,7 @@ function get_user_row($id) if (!$row) return false; - else return $row; + else return $userRows[$id]=$row; } function get_user_class()