42 const KEY_SUFFIX =
':2';
55 if ( isset(
$params[
'nativeSerialize'] ) ) {
56 $this->nativeSerialize =
$params[
'nativeSerialize'];
57 } elseif ( extension_loaded(
'apcu' ) && ini_get(
'apc.serializer' ) ===
'default' ) {
63 $this->logger->warning(
64 'The APCu extension is loaded and the apc.serializer INI setting ' .
65 'is set to "default". This can cause memory corruption! ' .
66 'You should change apc.serializer to "php" instead. ' .
67 'See <https://github.com/krakjoe/apcu/issues/38>.'
69 $this->nativeSerialize =
false;
71 $this->nativeSerialize =
true;
75 protected function doGet( $key, $flags = 0 ) {
77 apc_fetch( $key . self::KEY_SUFFIX )
82 if ( is_string(
$value ) && !$this->nativeSerialize ) {
90 public function set( $key,
$value, $exptime = 0, $flags = 0 ) {
92 $key . self::KEY_SUFFIX,
101 if ( !$this->nativeSerialize && !$this->
isInteger( $value ) ) {
107 public function delete( $key ) {
108 apc_delete( $key . self::KEY_SUFFIX );
114 return apc_inc( $key . self::KEY_SUFFIX,
$value );
118 return apc_dec( $key . self::KEY_SUFFIX,
$value );