/**
 * A function to store content a cache entry.
 *
 * @param string $filename The filename where cache entry is stored
 * @param array $cache_contents  The cache content
 * @return bool True if the entry was succesfully stored
 */
function Plugin_deliveryCacheStore_oxMemcached_oxMemcached_Delivery_cacheStore($filename, $cache_contents)
{
    $oMemcache = _oxMemcached_getMemcache();
    if ($oMemcache == false) {
        return false;
    }
    $expiryTime = 0;
    if (!empty($cache_contents['cache_expire'])) {
        $expiryTime = $cache_contents['cache_expire'];
    } else {
        if (is_numeric($GLOBALS['_MAX']['CONF']['oxMemcached']['memcachedExpireTime'])) {
            $expiryTime = $GLOBALS['_MAX']['CONF']['oxMemcached']['memcachedExpireTime'];
        }
    }
    $serializedCacheExport = serialize($cache_contents);
    // Store serialized cache
    // @ - to catch "memcached errno=10054: An existing connection was forcibly closed by the remote host", when one of servers is down
    $result = @$oMemcache->replace($filename, $serializedCacheExport, false, $expiryTime);
    if ($result !== true) {
        // Memcache set/replece can return null on error, so ensure, that for all errors results if false
        // @ - to catch "memcached errno=10054: An existing connection was forcibly closed by the remote host", when one of servers is down
        if (@$oMemcache->set($filename, $serializedCacheExport, false, $expiryTime) !== true) {
            return false;
        }
    }
    return true;
}
 /**
  * A function to delete entire delivery cache
  *
  * @return bool True if the entres were succesfully deleted
  */
 function _deleteAll()
 {
     $oMemcache = _oxMemcached_getMemcache();
     if ($oMemcache == false) {
         return false;
     }
     // @ - to catch memcached notices on errors
     return @$oMemcache->flush();
 }