add Discord Me cache

This commit is contained in:
小喵 2023-08-27 21:53:01 +08:00
parent 0393ab8b89
commit d95d78f5a2
Signed by: mt
GPG key ID: CD321C269EC63BB6
4 changed files with 60 additions and 2 deletions

View file

@ -128,7 +128,9 @@ HTML,
try {
$u = static::getU();
if ($u === null) return null;
return Auth::getMe($u);
$cachedMe = Redis::getCachedMe($_COOKIE['u']);
if ($cachedMe === null) return Redis::cacheMe($_COOKIE['u'], Auth::getMe($u));
return $cachedMe;
} catch (Exception) {
error_log('Failed to getMe.');
return null;