File tree Expand file tree Collapse file tree 3 files changed +17
-2
lines changed Expand file tree Collapse file tree 3 files changed +17
-2
lines changed Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ Yii Framework 2 redis extension Change Log
442.0.18 under development
55------------------------
66
7- - no changes in this release.
7+ - Bug # 247 : ` Cache::getValue() ` now returns ` false ` in case of missing key (rhertogh)
88
99
10102.0.17 January 11, 2022
Original file line number Diff line number Diff line change @@ -12,6 +12,16 @@ if you want to upgrade from version A to version C and there is
1212version B between A and C, you need to follow the instructions
1313for both A and B.
1414
15+ Upgrade from 2.0.17
16+ ------------------
17+
18+ * The ` Cache::getValue() ` method now adheres to the specifications and returns ` false ` in case of a missing
19+ (or expired) key. This might have impact in the following scenarios:
20+ * You specified a custom ` Cache::$serializer ` , depending on the serializer used ` Cache::get() ` might now
21+ return ` false ` instead of ` null ` in case of a missing (or expired) key.
22+ * You extended the ` Cache ` class, are using the protected method ` Cache::getValue() ` directly and expect
23+ a return value of ` null ` in case of a missing (or expired) key.
24+
1525Upgrade from 2.0.13
1626------------------
1727
Original file line number Diff line number Diff line change @@ -195,7 +195,12 @@ public function exists($key)
195195 */
196196 protected function getValue ($ key )
197197 {
198- return $ this ->getReplica ()->executeCommand ('GET ' , [$ key ]);
198+ $ value = $ this ->getReplica ()->executeCommand ('GET ' , [$ key ]);
199+ if ($ value === null ) {
200+ return false ; // Key is not in the cache or expired
201+ }
202+
203+ return $ value ;
199204 }
200205
201206 /**
You can’t perform that action at this time.
0 commit comments