summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUrban Müller2013-10-16 13:33:18 +0000
committerUrban Müller2013-10-16 13:33:18 +0000
commit481159435fa6d3acc2532e1c3af181c2375a1e9d (patch)
tree627eef6260ad7ee0e4cfeab600b124eb2df56f93
parentb65e71742a28e9cbb2b0c2b2c83807a8556551d6 (diff)
downloaditools-481159435fa6d3acc2532e1c3af181c2375a1e9d.tar.gz
itools-481159435fa6d3acc2532e1c3af181c2375a1e9d.tar.bz2
itools-481159435fa6d3acc2532e1c3af181c2375a1e9d.zip
return written value from it_cache::put
-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)