Browse Source

remove personal cache only on user login/logout

main
ghost 3 years ago
parent
commit
5bb859b6d0
  1. 3
      src/application/controller/login.php
  2. 5
      src/application/controller/logout.php

3
src/application/controller/login.php

@ -80,7 +80,8 @@ if (isset($_POST) && $_POST) {
$_SESSION['userName'] = $userName; $_SESSION['userName'] = $userName;
$_SESSION['userId'] = $userId; $_SESSION['userId'] = $userId;
$_memcache->flush(); $_memcache->delete('api.user.profile.' . $userName);
$_memcache->delete('api.user.avatar.' . $userName);
// Redirect // Redirect
header('Location: ' . PROJECT_HOST, true, 302); header('Location: ' . PROJECT_HOST, true, 302);

5
src/application/controller/logout.php

@ -3,9 +3,10 @@
if (isset($_SESSION['userName'])) { 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); header('Location: ' . PROJECT_HOST, true, 302);
Loading…
Cancel
Save