From fbd91d33a4962d25af92d05df81930f2794b63d6 Mon Sep 17 00:00:00 2001 From: Alex Grintsvayg Date: Fri, 2 Sep 2016 17:37:03 -0400 Subject: [PATCH] more caching --- lib/tools/Prefinery.class.php | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/lib/tools/Prefinery.class.php b/lib/tools/Prefinery.class.php index 7d990840..c891f72a 100644 --- a/lib/tools/Prefinery.class.php +++ b/lib/tools/Prefinery.class.php @@ -37,11 +37,10 @@ class Prefinery if ($user) { unset($user['invitation_code']); // so we dont leak it - } - - if ($useApc && $apcEnabled) - { - apc_store('prefinery-user-'.$emailOrId, $user, 3600); + if ($useApc && $apcEnabled) + { + apc_store('prefinery-user-'.$emailOrId, $user, 3600); + } } return $user; @@ -114,6 +113,11 @@ class Prefinery { throw new PrefineryException('Update tester must be called with a tester id'); } + $apcEnabled = extension_loaded('apc') && ini_get('apc.enabled'); + if ($apcEnabled) + { + apc_delete('prefinery-user-'.$testerData['id']); + } return static::put('/testers/' . $testerData['id'], ['tester' => array_diff_key(array_filter($testerData), ['id' => null])], false); }