[wp-trac] [WordPress Trac] #63022: Update cache.php - Improve function wp_cache_decr

WordPress Trac noreply at wordpress.org
Wed Feb 26 09:30:17 UTC 2025


#63022: Update cache.php - Improve function wp_cache_decr
-------------------------+-----------------------------
 Reporter:  docjojo      |      Owner:  (none)
     Type:  enhancement  |     Status:  new
 Priority:  normal       |  Milestone:  Awaiting Review
Component:  Cache API    |    Version:  6.7.2
 Severity:  normal       |   Keywords:  wp_cache_decr
  Focuses:  performance  |
-------------------------+-----------------------------
 Make the lines 519-549 in class-wp-object-cache.php obsolete by adjusting
 the function call to the function wp_cache_decr, line 252 in cache.php.

 Change

 `return $wp_object_cache->decr( $key, $offset, $group ); `
 to
 `return $wp_object_cache->incr( $key, ((int) $offset) * -1), $group );`

 because DECR by offset == INCR by (offset * -1)

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/63022>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list