diff options
Diffstat (limited to 'it_cache.class')
-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; } |