/** * Commits this TransactionValue, * deletes key if this is a delete, sets it and deletes tmp key if it s a set */ public function commit() { if ($this->isSetType()) { \Sky\Memcache::setMemValue($this->getKey(), $this->getValue(), $this->getDuration()); \Sky\Memcache::deleteMemValue($this->getTmpKey()); } else { \Sky\Memcache::deleteMemValue($this->getKey()); } }
/** * Sets the temporary key and stores the tmp value in cache * @param string $key * @param mixed $value * @param string $duration */ public function __construct($key, $value, $duration = null) { $this->key = $key; $this->duration = $duration; \Sky\Memcache::setMemValue($this->generateTmpKey(), $value); }