public function newEnd($print = true)
{
// @codeCoverageIgnoreStart
if (!$this->enabled) {
return false;
}
// @codeCoverageIgnoreEnd
$data = ob_get_clean();
/* @var $cachedata CacheData */
$cachedata = $this->loopdata[$this->inloop];
$cachedata->appendData($data);
$cachedata->generateDependenciesHash($this);
$mainkey = $this->keyFromDeps($cachedata->getKey(), $cachedata->dependencies);
if (!$this->storeP($cachedata, 'cacherecursive', 0, $mainkey)) {
throw new \Cachearium\Exceptions\CacheStoreFailure("Storing key");
}
if (!$this->storeData($cachedata)) {
throw new \Cachearium\Exceptions\CacheStoreFailure("Storing data");
}
// if recursive
$this->inloop--;
if ($this->inloop > 0) {
return false;
}
if ($print) {
$key = "cache-" . rand();
// @codeCoverageIgnoreStart
if (static::$debugOnPage) {
echo '<span class="debug-probe-begin"
data-key="' . $key . '" data-base="' . $cachedata->getKey()->base . '" data-id="' . $cachedata->getKey()->id . '" data-sub="' . print_r($cachedata->getKey()->sub, true) . '" data-lifetime="' . $cachedata->lifetime . '" data-backend="' . get_class($this) . '" data-type="save"></span>';
}
// @codeCoverageIgnoreEnd
echo $cachedata->stringify($this);
// @codeCoverageIgnoreStart
if (static::$debugOnPage) {
echo '<span class="debug-probe-end" data-key="' . $key . '"></span>';
}
// @codeCoverageIgnoreEnd
return;
}
return $cachedata->stringify($this);
}