diff options
author | Erich Eckner <git@eckner.net> | 2019-02-13 14:37:51 +0100 |
---|---|---|
committer | Erich Eckner <git@eckner.net> | 2019-02-13 14:37:51 +0100 |
commit | 5dfac6e689dd6068979869c7cd989cd32e4c6860 (patch) | |
tree | 849bfa4634ab70fe839f9c2a3893edea30958a20 /packages/pkginfo.php | |
parent | f5175dca32467dbfecfc1d058b99e7b0a19b9764 (diff) | |
download | archweb32-5dfac6e689dd6068979869c7cd989cd32e4c6860.tar.xz |
use apcu instead of memcache
Diffstat (limited to 'packages/pkginfo.php')
-rw-r--r-- | packages/pkginfo.php | 16 |
1 files changed, 3 insertions, 13 deletions
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 |