[wp-trac] [WordPress Trac] #57743: Add `$found` parameter to `wp_cache_get_multiple()`
WordPress Trac
noreply at wordpress.org
Fri Feb 17 04:09:26 UTC 2023
#57743: Add `$found` parameter to `wp_cache_get_multiple()`
---------------------------+-----------------------------
Reporter: peterwilsoncc | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Cache API | Version:
Severity: normal | Keywords:
Focuses: |
---------------------------+-----------------------------
`wp_cache_get()` includes the forth parameter `$found`. It's a boolean
passed by reference to allow developers to determine whether the returned
value `false` indicates a populated cache with the value `false`.
{{{#!php
<?php
wp_cache_set( 'ticket-57741', false );
$found = false;
$result = wp_cache_get( 'ticket-57741', '', false, $found );
var_dump( $found, $result );
// true, false
$found = false;
$result = wp_cache_get( 'invalid-key', '', false, $found );
var_dump( $found, $result );
// false, false
}}}
`wp_cache_get_multiple()` does not include a similar parameter and could
benefit from one. Instead of been a boolean, it would be an array passed
by reference.
At the conclusion of the function running, the `$found` array would be of
the form:
{{{
array(
'set-key' => true,
'unset-key' => false,
)
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/57743>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list