diff options
author | Christian Schneider | 2015-09-10 16:15:13 +0200 |
---|---|---|
committer | Christian Schneider | 2015-09-10 16:15:13 +0200 |
commit | 74ec528f1e737e323c8a0fafeb4f42a5a31812d5 (patch) | |
tree | 10c108ca3d81ba397f9c22d56b2c4abe15a0f51a | |
parent | a3628fc906934b20757907699680150242a9cb0d (diff) | |
download | itools-74ec528f1e737e323c8a0fafeb4f42a5a31812d5.tar.gz itools-74ec528f1e737e323c8a0fafeb4f42a5a31812d5.tar.bz2 itools-74ec528f1e737e323c8a0fafeb4f42a5a31812d5.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; } |