unserialize( apcu_fetch( $key . self::KEY_SUFFIX ) ); } protected function getWithToken( $key, &$casToken, $flags = 0 ) { $casToken = null; $blob = apcu_fetch( $key . self::KEY_SUFFIX ); $value = $this->unserialize( $blob ); if ( $value !== false ) { $casToken = $blob; // don't bother hashing this } return $value; } public function set( $key, $value, $exptime = 0, $flags = 0 ) { apcu_store( $key . self::KEY_SUFFIX, $this->serialize( $value ), $exptime ); return true; } public function add( $key, $value, $exptime = 0, $flags = 0 ) { return apcu_add( $key . self::KEY_SUFFIX, $this->serialize( $value ), $exptime ); } public function delete( $key, $flags = 0 ) { apcu_delete( $key . self::KEY_SUFFIX ); return true; } public function incr( $key, $value = 1 ) { /** * @todo When we only support php 7 or higher remove this hack * * https://github.com/krakjoe/apcu/issues/166 */ if ( apcu_exists( $key . self::KEY_SUFFIX ) ) { return apcu_inc( $key . self::KEY_SUFFIX, $value ); } else { return false; } } public function decr( $key, $value = 1 ) { /** * @todo When we only support php 7 or higher remove this hack * * https://github.com/krakjoe/apcu/issues/166 */ if ( apcu_exists( $key . self::KEY_SUFFIX ) ) { return apcu_dec( $key . self::KEY_SUFFIX, $value ); } else { return false; } } public function merge( $key, callable $callback, $exptime = 0, $attempts = 10, $flags = 0 ) { return $this->mergeViaCas( $key, $callback, $exptime, $attempts, $flags ); } }