42 private const KEY_SUFFIX =
':5';
45 private static $CAS_MAX_ATTEMPTS = 100;
49 $params[
'segmentationSize'] = INF;
55 ini_set(
'apc.use_request_time',
'0' );
57 if ( PHP_SAPI ===
'cli' ) {
66 protected function doGet( $key, $flags = 0, &$casToken =
null ) {
70 $value = apcu_fetch( $key . self::KEY_SUFFIX );
71 if ( $getToken && $value !==
false ) {
80 protected function doSet( $key, $value, $exptime = 0, $flags = 0 ) {
83 return apcu_store( $key . self::KEY_SUFFIX, $value, $ttl );
86 protected function doAdd( $key, $value, $exptime = 0, $flags = 0 ) {
87 if ( apcu_exists( $key . self::KEY_SUFFIX ) ) {
94 return apcu_add( $key . self::KEY_SUFFIX, $value, $ttl );
97 protected function doDelete( $key, $flags = 0 ) {
98 apcu_delete( $key . self::KEY_SUFFIX );
106 if ( $step === $init ) {
109 $result = apcu_inc( $key . self::KEY_SUFFIX, $step,
$success, $ttl );
112 for ( $i = 0; $i < self::$CAS_MAX_ATTEMPTS; ++$i ) {
113 $oldCount = apcu_fetch( $key . self::KEY_SUFFIX );
114 if ( $oldCount ===
false ) {
117 if ( apcu_add( $key . self::KEY_SUFFIX, $count, $ttl ) ) {
121 } elseif ( is_int( $oldCount ) ) {
122 $count = $oldCount + $step;
123 if ( apcu_cas( $key . self::KEY_SUFFIX, $oldCount, $count ) ) {
138class_alias( APCUBagOStuff::class,
'APCUBagOStuff' );
array $params
The job parameters.