| @@ 144-149 (lines=6) @@ | ||
| 141 | $new = json_encode($new); |
|
| 142 | } |
|
| 143 | self::$cache->watch($this->getNamespace() . $key); |
|
| 144 | if ($this->get($key) === $old) { |
|
| 145 | $result = self::$cache->multi() |
|
| 146 | ->set($this->getNamespace() . $key, $new) |
|
| 147 | ->exec(); |
|
| 148 | return ($result === false) ? false : true; |
|
| 149 | } |
|
| 150 | self::$cache->unwatch(); |
|
| 151 | return false; |
|
| 152 | } |
|
| @@ 163-168 (lines=6) @@ | ||
| 160 | */ |
|
| 161 | public function cad($key, $old) { |
|
| 162 | self::$cache->watch($this->getNamespace() . $key); |
|
| 163 | if ($this->get($key) === $old) { |
|
| 164 | $result = self::$cache->multi() |
|
| 165 | ->del($this->getNamespace() . $key) |
|
| 166 | ->exec(); |
|
| 167 | return ($result === false) ? false : true; |
|
| 168 | } |
|
| 169 | self::$cache->unwatch(); |
|
| 170 | return false; |
|
| 171 | } |
|