| @@ 133-148 (lines=16) @@ | ||
| 130 | /** |
|
| 131 | * {@inheritdoc} |
|
| 132 | */ |
|
| 133 | public function inc($key, $step = 1) |
|
| 134 | { |
|
| 135 | // due to a bug in memcached PHP module |
|
| 136 | // https://bugs.php.net/bug.php?id=51434 |
|
| 137 | // we'll check if the $key has a non numeric value |
|
| 138 | if ($this->bug51434fix) { |
|
| 139 | $value = $this->get($key); |
|
| 140 | if (is_null($value) || !is_numeric($value)) { |
|
| 141 | return false; |
|
| 142 | } |
|
| 143 | } |
|
| 144 | $val = $this->memcached->increment($key, $step); |
|
| 145 | ||
| 146 | // on some servers it will return 0 instead of FALSE |
|
| 147 | return ($val) ? $val : false; |
|
| 148 | } |
|
| 149 | ||
| 150 | /** |
|
| 151 | * {@inheritdoc} |
|
| @@ 153-168 (lines=16) @@ | ||
| 150 | /** |
|
| 151 | * {@inheritdoc} |
|
| 152 | */ |
|
| 153 | public function dec($key, $step = 1) |
|
| 154 | { |
|
| 155 | // due to a bug in memcached PHP module |
|
| 156 | // https://bugs.php.net/bug.php?id=51434 |
|
| 157 | // we'll check if the $key has a non numeric value |
|
| 158 | if ($this->bug51434fix) { |
|
| 159 | $value = $this->get($key); |
|
| 160 | if (is_null($value) || !is_numeric($value)) { |
|
| 161 | return false; |
|
| 162 | } |
|
| 163 | } |
|
| 164 | $val = $this->memcached->decrement($key, $step); |
|
| 165 | ||
| 166 | // on some servers it will return 0 instead of FALSE |
|
| 167 | return ($val) ? $val : false; |
|
| 168 | } |
|
| 169 | ||
| 170 | /** |
|
| 171 | * Checks is the memcache server is running |
|