Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/lib/helper.php
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2019-02-13 14:37:51 +0100
committerErich Eckner <git@eckner.net>2019-02-13 14:37:51 +0100
commit5dfac6e689dd6068979869c7cd989cd32e4c6860 (patch)
tree849bfa4634ab70fe839f9c2a3893edea30958a20 /lib/helper.php
parentf5175dca32467dbfecfc1d058b99e7b0a19b9764 (diff)
use apcu instead of memcache
Diffstat (limited to 'lib/helper.php')
-rw-r--r--lib/helper.php16
1 files changed, 3 insertions, 13 deletions
diff --git a/lib/helper.php b/lib/helper.php
index a9dba64..73b97e8 100644
--- a/lib/helper.php
+++ b/lib/helper.php
@@ -86,25 +86,15 @@ function format_time_duration($val) {
function git_url($repository,$type,$commit,$path,$line = null,$commit_is_hash = null) {
global $git_available;
if (!isset($git_available)) {
- $memcache = new Memcache;
- if ($memcache -> connect('localhost', 11211)) {
- $git_available = $memcache -> get('git_available');
- $memcache_available = true;
- } else {
- $git_available = false;
- $memcache_available = false;
- }
- if ($git_available === false) {
+ $git_available = apcu_fetch('git_available', $apcu_success);
+ if ($apcu_success == false) {
$git_available =
preg_match(
"/ 200 OK$/",
get_headers("https://git.archlinux32.org/archlinux32/packages")[0]
);
- if ($memcache_available)
- $memcache -> set('git_available',$git_available,0,120);
+ apcu_store('git_available', $git_available, 120);
};
- if ($memcache_available)
- $memcache -> close();
$git_available = $git_available == 1;
}
if (!isset($commit_is_hash))