| @@ 234-246 (lines=13) @@ | ||
| 231 | * |
|
| 232 | * @return int|bool Returns the new item's value on success or FALSE on failure. |
|
| 233 | */ |
|
| 234 | public function increment($key) |
|
| 235 | { |
|
| 236 | $counter = $this->adapter->get($key); |
|
| 237 | ||
| 238 | if (false === $counter) { |
|
| 239 | $counter = 1; |
|
| 240 | $this->adapter->set($key, $counter); |
|
| 241 | } else { |
|
| 242 | $counter = $this->adapter->increment($key); |
|
| 243 | } |
|
| 244 | ||
| 245 | return $counter; |
|
| 246 | } |
|
| 247 | ||
| 248 | /** |
|
| 249 | * {@inheritdoc} |
|
| @@ 359-375 (lines=17) @@ | ||
| 356 | * @param string $key The key to increment. |
|
| 357 | * @return int|bool Returns the new item's value on success or FALSE on failure. |
|
| 358 | */ |
|
| 359 | public function increment($key) |
|
| 360 | { |
|
| 361 | // if (true === \Memcached::OPT_BINARY_PROTOCOL) { |
|
| 362 | // // Increment will initialize the value (if not available) |
|
| 363 | // // only when OPT_BINARY_PROTOCOL is set to true! |
|
| 364 | // return $this->adapter->increment($key, 1); |
|
| 365 | // } |
|
| 366 | $counter = $this->adapter->get($key); |
|
| 367 | if (false === $counter) { |
|
| 368 | $counter = 1; |
|
| 369 | $this->adapter->set($key, $counter); |
|
| 370 | } else { |
|
| 371 | $counter = $this->adapter->increment($key); |
|
| 372 | } |
|
| 373 | ||
| 374 | return $counter; |
|
| 375 | } |
|
| 376 | ||
| 377 | /** |
|
| 378 | * {@inheritdoc} |
|