diff options
author | Christian Schneider | 2015-09-10 16:15:13 +0200 |
---|---|---|
committer | Urban Müller | 2015-11-09 14:29:17 +0100 |
commit | 7c8d68afbf676446f6446f9bdf8bcbfafa92bdcf (patch) | |
tree | 4d0ff512f978fcf6e03bb6d05f8d02802fb4d21b | |
parent | 3deecf612f4edb20097ff29f8ee97d37bf5b4b8d (diff) | |
download | itools-7c8d68afbf676446f6446f9bdf8bcbfafa92bdcf.tar.gz itools-7c8d68afbf676446f6446f9bdf8bcbfafa92bdcf.tar.bz2 itools-7c8d68afbf676446f6446f9bdf8bcbfafa92bdcf.zip |
Fix it_cache to pass tests on PHP7 (different code paths because of memcached instead of apcu/memcache)
-rw-r--r-- | it_cache.class | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/it_cache.class b/it_cache.class index 27be919..c5b8b2c 100644 --- a/it_cache.class +++ b/it_cache.class @@ -48,10 +48,17 @@ static function get($key, $p = array()) { $p = it_cache::_defaults($p); - if ($result = $GLOBALS['it_cache_local'][$key]) - ; # Use local copy + if (isset($GLOBALS['it_cache_local'][$key])) + { + # Use local copy + $result = $GLOBALS['it_cache_local'][$key]; + $success = true; + } else if ($p['distributed'] && ($memcache = it_cache::_get_memcache($p))) - $result = $success = @$memcache->get($key); + { + $result = @$memcache->get($key); + $success = !$memcache->getResultCode(); + } else $result = ($func = self::$_fetch_func) ? $func($key, $success) : null; @@ -103,7 +110,10 @@ static function _get_memcache($p) static function _memcache_local_fetch($key, &$success) { if ($memcache = it_cache::_get_memcache(it_cache::_defaults(array()))) - $result = $success = @$memcache->get(self::_memcache_local_key($key)); + { + $result = @$memcache->get(self::_memcache_local_key($key)); + $success = !$memcache->getResultCode(); + } return $result; } |