The rest of this class supports having a key with a null value by using
array_key_exists() instead of isset(). So Use $this->has() in
getWithSetCallback() so a null value is still identified as set.
Change-Id: Ida74a6f7e284e98f9a7d76d97312ebe2ee343f10
* @return mixed The cached value if found or the result of $callback otherwise
*/
public function getWithSetCallback( $key, callable $callback ) {
- $value = $this->get( $key );
- if ( $value === null ) {
+ if ( $this->has( $key ) ) {
+ $value = $this->get( $key );
+ } else {
$value = call_user_func( $callback );
if ( $value !== false ) {
$this->set( $key, $value );