private function executeSet($data, $time)
{
if ($this->isDisabled() || !isset($this->key)) {
return false;
}
$store = array();
$store['return'] = $data;
$store['createdOn'] = time();
if (isset($time) && $time instanceof \DateTime) {
$expiration = $time->getTimestamp();
$cacheTime = $expiration - $store['createdOn'];
} else {
$cacheTime = self::$cacheTime;
}
$expiration = $store['createdOn'] + $cacheTime;
if ($cacheTime > 0) {
$expirationDiff = rand(0, floor($cacheTime * 0.15));
$expiration -= $expirationDiff;
}
if ($this->stampedeRunning === true) {
$spkey = $this->key;
$spkey[0] = 'sp';
// change "cache" data namespace to stampede namespace
$this->driver->clear($spkey);
$this->stampedeRunning = false;
}
return $this->driver->storeData($this->key, $store, $expiration);
}