[wp-trac] [WordPress Trac] #62236: Why do wp_cache_incr / wp_cache_decr not allow negative values?

WordPress Trac noreply at wordpress.org
Wed Oct 16 09:30:07 UTC 2024


#62236: Why do wp_cache_incr / wp_cache_decr not allow negative values?
-------------------------+------------------------------
 Reporter:  docjojo      |       Owner:  (none)
     Type:  enhancement  |      Status:  new
 Priority:  normal       |   Milestone:  Awaiting Review
Component:  Cache API    |     Version:  6.6.2
 Severity:  normal       |  Resolution:
 Keywords:               |     Focuses:
-------------------------+------------------------------

Comment (by docjojo):

 but does it make sense?

 ''Memcached::decrement() will set the item to the initial_value parameter
 if the key doesn't exist.''
 Initial_value is 0 if not set.

 wp_cache_incr returns false, if key is not set, memcached returns 0.
 That is also not consistent.

 Question remains, why not allow negative integer?

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/62236#comment:3>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list