dépôts
/
lhc
/
web
/
wiklou.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
MapCacheLRU: Support null values in getWithSetCallback()
[lhc/web/wiklou.git]
/
includes
/
libs
/
MapCacheLRU.php
diff --git
a/includes/libs/MapCacheLRU.php
b/includes/libs/MapCacheLRU.php
index
90c9a75
..
2f5a454
100644
(file)
--- a/
includes/libs/MapCacheLRU.php
+++ b/
includes/libs/MapCacheLRU.php
@@
-115,8
+115,9
@@
class MapCacheLRU {
* @return mixed The cached value if found or the result of $callback otherwise
*/
public function getWithSetCallback( $key, callable $callback ) {
* @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 );
$value = call_user_func( $callback );
if ( $value !== false ) {
$this->set( $key, $value );