Make WordPress Core

Opened 8 weeks ago

Last modified 7 weeks ago

#63022 new enhancement

Update cache.php - Improve function wp_cache_decr

Reported by: docjojo's profile docjojo Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 6.7.2
Component: Cache API Keywords: wp_cache_decr has-patch
Focuses: performance Cc:

Description

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)

Change History (2)

This ticket was mentioned in PR #8413 on WordPress/wordpress-develop by @docjojo.


8 weeks ago
#1

  • Keywords has-patch added

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)

Trac ticket:

https://core.trac.wordpress.org/ticket/63022#ticket

#2 in reply to: ↑ description @ameliamoon
7 weeks ago

Replying to docjojo:

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)

i have the same problem

Note: See TracTickets for help on using tickets.