Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions object-cache.php
Original file line number Diff line number Diff line change
Expand Up @@ -885,7 +885,7 @@ public function add( $key, $value, $group = 'default', $expiration = 0, $server_
if ( in_array( $group, $this->no_mc_groups ) ) {

// Add does not set the value if the key exists; mimic that here
if ( isset( $this->cache[$derived_key] ) )
if ( array_key_exists( $derived_key, $this->cache ) )
return false;

$this->add_to_internal_cache( $derived_key, $value );
Expand Down Expand Up @@ -990,7 +990,7 @@ public function append( $key, $value, $group = 'default', $server_key = '', $byK

// If group is a non-Memcached group, append to runtime cache value, not Memcached
if ( in_array( $group, $this->no_mc_groups ) ) {
if ( ! isset( $this->cache[$derived_key] ) )
if ( ! array_key_exists( $derived_key, $this->cache ) )
return false;

$combined = $this->combine_values( $this->cache[$derived_key], $value, 'app' );
Expand Down Expand Up @@ -1179,7 +1179,7 @@ public function delete( $key, $group = 'default', $time = 0, $server_key = '', $

// Remove from no_mc_groups array
if ( in_array( $group, $this->no_mc_groups ) ) {
if ( isset( $this->cache[$derived_key] ) )
if ( array_key_exists( $derived_key, $this->cache ) )
unset( $this->cache[$derived_key] );

return true;
Expand Down Expand Up @@ -1573,7 +1573,7 @@ public function increment( $key, $offset = 1, $group = 'default' ) {
if ( in_array( $group, $this->no_mc_groups ) ) {

// Only increment if the key already exists and the number is currently 0 or greater (mimics memcached behavior)
if ( isset( $this->cache[$derived_key] ) && $this->cache[$derived_key] >= 0 ) {
if ( array_key_exists( $derived_key, $this->cache ) && $this->cache[$derived_key] >= 0 ) {

// If numeric, add; otherwise, consider it 0 and do nothing
if ( is_numeric( $this->cache[$derived_key] ) )
Expand Down Expand Up @@ -1643,7 +1643,7 @@ public function prepend( $key, $value, $group = 'default', $server_key = '', $by

// If group is a non-Memcached group, prepend to runtime cache value, not Memcached
if ( in_array( $group, $this->no_mc_groups ) ) {
if ( ! isset( $this->cache[$derived_key] ) )
if ( ! array_key_exists( $derived_key, $this->cache ) )
return false;

$combined = $this->combine_values( $this->cache[$derived_key], $value, 'pre' );
Expand Down Expand Up @@ -1713,7 +1713,7 @@ public function replace( $key, $value, $group = 'default', $expiration = 0, $ser
if ( in_array( $group, $this->no_mc_groups ) ) {

// Replace won't save unless the key already exists; mimic this behavior here
if ( ! isset( $this->cache[$derived_key] ) )
if ( ! array_key_exists( $derived_key, $this->cache ) )
return false;

$this->cache[$derived_key] = $value;
Expand Down Expand Up @@ -2086,7 +2086,7 @@ public function add_non_persistent_groups( $groups ) {
public function get_from_runtime_cache( $key, $group ) {
$derived_key = $this->buildKey( $key, $group );

if ( isset( $this->cache[$derived_key] ) )
if ( array_key_exists( $derived_key, $this->cache ) )
return $this->cache[$derived_key];

return false;
Expand Down