From 5bb859b6d0117a78ef982ce57e2aef084e933b9c Mon Sep 17 00:00:00 2001 From: ghost Date: Mon, 3 Jan 2022 00:57:24 +0200 Subject: [PATCH] remove personal cache only on user login/logout --- src/application/controller/login.php | 3 ++- src/application/controller/logout.php | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/application/controller/login.php b/src/application/controller/login.php index 5c9712b..2db25b0 100644 --- a/src/application/controller/login.php +++ b/src/application/controller/login.php @@ -80,7 +80,8 @@ if (isset($_POST) && $_POST) { $_SESSION['userName'] = $userName; $_SESSION['userId'] = $userId; - $_memcache->flush(); + $_memcache->delete('api.user.profile.' . $userName); + $_memcache->delete('api.user.avatar.' . $userName); // Redirect header('Location: ' . PROJECT_HOST, true, 302); diff --git a/src/application/controller/logout.php b/src/application/controller/logout.php index e1ae647..dc264a7 100644 --- a/src/application/controller/logout.php +++ b/src/application/controller/logout.php @@ -3,9 +3,10 @@ if (isset($_SESSION['userName'])) { - session_destroy(); + $_memcache->delete('api.user.profile.' . $_SESSION['userName']); + $_memcache->delete('api.user.avatar.' . $_SESSION['userName']); - $_memcache->flush(); + session_destroy(); } header('Location: ' . PROJECT_HOST, true, 302); \ No newline at end of file