| @@ 66-77 (lines=12) @@ | ||
| 63 | return true; |
|
| 64 | } |
|
| 65 | ||
| 66 | public function incr( $key, $value = 1 ) { |
|
| 67 | /** |
|
| 68 | * @todo When we only support php 7 or higher remove this hack |
|
| 69 | * |
|
| 70 | * https://github.com/krakjoe/apcu/issues/166 |
|
| 71 | */ |
|
| 72 | if ( apcu_exists( $key . self::KEY_SUFFIX ) ) { |
|
| 73 | return apcu_inc( $key . self::KEY_SUFFIX, $value ); |
|
| 74 | } else { |
|
| 75 | return apcu_set( $key . self::KEY_SUFFIX, $value ); |
|
| 76 | } |
|
| 77 | } |
|
| 78 | ||
| 79 | public function decr( $key, $value = 1 ) { |
|
| 80 | /** |
|
| @@ 79-90 (lines=12) @@ | ||
| 76 | } |
|
| 77 | } |
|
| 78 | ||
| 79 | public function decr( $key, $value = 1 ) { |
|
| 80 | /** |
|
| 81 | * @todo When we only support php 7 or higher remove this hack |
|
| 82 | * |
|
| 83 | * https://github.com/krakjoe/apcu/issues/166 |
|
| 84 | */ |
|
| 85 | if ( apcu_exists( $key . self::KEY_SUFFIX ) ) { |
|
| 86 | return apcu_dec( $key . self::KEY_SUFFIX, $value ); |
|
| 87 | } else { |
|
| 88 | return apcu_set( $key . self::KEY_SUFFIX, -$value ); |
|
| 89 | } |
|
| 90 | } |
|
| 91 | } |
|
| 92 | ||