File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 33The change log describes what is "Added", "Removed", "Changed" or "Fixed" between each release.
44
55## UNRELEASED
6+ ## 0.4.3
7+
8+ ### Fixed
9+
10+ * Do not lose the data when you start using the ` TaggablePSR6PoolAdapter `
611
712## 0.4.2
813
Original file line number Diff line number Diff line change @@ -82,9 +82,13 @@ public function get()
8282 {
8383 $ rawItem = $ this ->cacheItem ->get ();
8484
85- if (is_array ($ rawItem ) && isset ($ rawItem ['value ' ])) {
85+ // If it is a cache item we created
86+ if ($ this ->isItemCreatedHere ($ rawItem )) {
8687 return $ rawItem ['value ' ];
8788 }
89+
90+ // This is an item stored before we used this fake cache
91+ return $ rawItem ;
8892 }
8993
9094 /**
@@ -178,12 +182,24 @@ private function initializeTags()
178182 if ($ this ->cacheItem ->isHit ()) {
179183 $ rawItem = $ this ->cacheItem ->get ();
180184
181- if (is_array ( $ rawItem ) && isset ($ rawItem[ ' tags ' ] )) {
185+ if ($ this -> isItemCreatedHere ($ rawItem )) {
182186 $ this ->tags = $ rawItem ['tags ' ];
183187 }
184188 }
185189
186190 $ this ->initialized = true ;
187191 }
188192 }
193+
194+ /**
195+ * Verify that the raw data is a cache item created by this class.
196+ *
197+ * @param mixed $rawItem
198+ *
199+ * @return bool
200+ */
201+ private function isItemCreatedHere ($ rawItem )
202+ {
203+ return is_array ($ rawItem ) && isset ($ rawItem ['value ' ]) && isset ($ rawItem ['tags ' ]) && count ($ rawItem ) === 2 ;
204+ }
189205}
You can’t perform that action at this time.
0 commit comments