public bool
store
(mixed $data, mixed $id, mixed $group = null, mixed $wrkarounds = true)
/**
* Stop the cache buffer and store the cached data
*
* @param mixed $data The data to store
* @param string $id The cache data ID
* @param string $group The cache data group
* @param boolean $wrkarounds True to use workarounds
*
* @return boolean
*
* @since 1.7.0
*/
public function store($data, $id, $group = null, $wrkarounds = true)
{
if ($this->_locktest->locked === false && $this->_locktest->locklooped === true) {
// We can not store data because another process is in the middle of saving
return false;
}
// Get page data from the application object
if (!$data) {
$data = Factory::getApplication()->getBody();
// Only attempt to store if page data exists.
if (!$data) {
return false;
}
}
// Get id and group and reset the placeholders
if (!$id) {
$id = $this->_id;
}
if (!$group) {
$group = $this->_group;
}
if ($wrkarounds) {
$data = Cache::setWorkarounds($data, array('nopathway' => 1, 'nohead' => 1, 'nomodules' => 1, 'headers' => true));
}
$result = $this->cache->store(serialize($data), $id, $group);
if ($this->_locktest->locked === true) {
$this->cache->unlock($id, $group);
}
return $result;
}