diff options
Diffstat (limited to 'it_cache.class')
-rw-r--r-- | it_cache.class | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/it_cache.class b/it_cache.class index 5537b91..1a1ea02 100644 --- a/it_cache.class +++ b/it_cache.class @@ -41,7 +41,7 @@ static function _defaults($p) /** * Get value for specific key from cache. Can be mixed value but no objects. * @param $key Key to get value for - * @param $p['distributed'] Use distributed memcache [false] + * @param $p['distributed'] Use distributed memcache (scalars may become strings) [false] * @return Value for given key or null */ static function get($key, $p = array()) @@ -51,18 +51,18 @@ static function get($key, $p = array()) if ($result = $GLOBALS['it_cache_local'][$key]) ; # Use local copy else if ($p['distributed'] && ($memcache = it_cache::_get_memcache($p))) - $result = @$memcache->get($key); + $result = $success = @$memcache->get($key); else - $result = ($func = self::$_fetch_func) ? $func($key) : null; + $result = ($func = self::$_fetch_func) ? $func($key, $success) : null; - return $result; + return $success === false ? null : $result; } /** * Put value for specific key into cache. Can be mixed value but no objects. * @param $key Key to put value with * @param $value Value to put (mixed but no objects allowed) - * @param $p['distributed'] Use distributed memcache [false] + * @param $p['distributed'] Use distributed memcache (scalars may become strings) [false] * @param $p['ttl'] Time to live for this key/value-pair in seconds * @return Returns $value */ |