From 5dfac6e689dd6068979869c7cd989cd32e4c6860 Mon Sep 17 00:00:00 2001 From: Erich Eckner Date: Wed, 13 Feb 2019 14:37:51 +0100 Subject: use apcu instead of memcache --- packages/pkginfo.php | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) (limited to 'packages') diff --git a/packages/pkginfo.php b/packages/pkginfo.php index 6cb3bab..86f7100 100644 --- a/packages/pkginfo.php +++ b/packages/pkginfo.php @@ -25,14 +25,7 @@ require_once BASE . "/lib/helper.php"; require_once BASE . "/lib/mysql.php"; require_once BASE . "/lib/style.php"; - $memcache = new Memcache; - if ($memcache -> connect('localhost', 11211)) { - $memcache_available = true; - $pkgapi_reachable = $memcache -> get('pkgapi_reachable'); - } else { - $memcache_available = false; - $pkgapi_reachable = false; - } + $pkgapi_reachable = apcu_fetch('pkgapi_reachable', $apcu_success); $tld = explode('.', $_SERVER['HTTP_HOST']); end($tld); $tld = current($tld); @@ -43,16 +36,13 @@ require_once BASE . "/lib/style.php"; $protocol = 'https'; else $protocol = 'http'; - if ($pkgapi_reachable === false) { + if ($apcu_success == false) { if (site_is_reachable($protocol . '://pkgapi.archlinux32.' . $tld . '/')) $pkgapi_reachable = 'YES'; else $pkgapi_reachable = 'NO'; - if ($memcache_available) - $memcache -> set('pkgapi_reachable', $pkgapi_reachable, 0, 300); + apcu_store('pkgapi_reachable', $pkgapi_reachable, 300); } - if ($memcache_available) - $memcache -> close(); if ($pkgapi_reachable == 'YES') $skip_json_checks = false; else -- cgit v1.2.3-70-g09d2