summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--it_cache.class11
1 files changed, 7 insertions, 4 deletions
diff --git a/it_cache.class b/it_cache.class
index 724651f..3641d59 100644
--- a/it_cache.class
+++ b/it_cache.class
@@ -66,7 +66,7 @@ static function get($key, $p = array())
* @param $value Value to put (mixed but no objects allowed)
* @param $p['distributed'] Use distributed memcache [false]
* @param $p['ttl'] Time to live for this key/value-pair in seconds
- * @return Boolean if value was put into cache
+ * @return Returns $value
*/
static function put($key, $value, $p = array())
{
@@ -74,17 +74,20 @@ static function put($key, $value, $p = array())
if ($p['distributed'] && ($memcache = it_cache::_get_memcache($p)))
{
- $result = @$memcache->set($key, $value, MEMCACHE_COMPRESSED, $p['ttl']);
+ $success = @$memcache->set($key, $value, MEMCACHE_COMPRESSED, $p['ttl']);
}
else
{
function_exists("eaccelerator_gc") && eaccelerator_gc();
- $result = ($func = self::$_store_func) ? $func($key, $value, $p['ttl']) : null;
+ $success = ($func = self::$_store_func) ? $func($key, $value, $p['ttl']) : null;
}
+ if (!$success)
+ it::error("it_cache::put failed");
+
$GLOBALS['it_cache_local'][$key] = $value; # Also store local copy
- return $result;
+ return $value;
}
static function _get_memcache($p)