@@ -29,6 +29,8 @@ class Psr6Cache implements CacheInterface, PruneableInterface, ResettableInterfa
29
29
{
30
30
use ProxyTrait;
31
31
32
+ private const METADATA_EXPIRY_OFFSET = 1527506807 ;
33
+
32
34
private $ createCacheItem ;
33
35
private $ cacheItemPrototype ;
34
36
@@ -58,7 +60,7 @@ function ($key, $value, $allowInt = false) use (&$cacheItemPrototype) {
58
60
}
59
61
$ this ->createCacheItem = $ createCacheItem ;
60
62
61
- return $ createCacheItem ($ key , $ value , $ allowInt );
63
+ return $ createCacheItem ($ key , null , $ allowInt)-> set ( $ value );
62
64
};
63
65
}
64
66
@@ -147,8 +149,29 @@ public function getMultiple($keys, $default = null)
147
149
}
148
150
$ values = array ();
149
151
152
+ if (!$ this ->pool instanceof AdapterInterface) {
153
+ foreach ($ items as $ key => $ item ) {
154
+ $ values [$ key ] = $ item ->isHit () ? $ item ->get () : $ default ;
155
+ }
156
+
157
+ return $ value ;
158
+ }
159
+
150
160
foreach ($ items as $ key => $ item ) {
151
- $ values [$ key ] = $ item ->isHit () ? $ item ->get () : $ default ;
161
+ if (!$ item ->isHit ()) {
162
+ $ values [$ key ] = $ default ;
163
+ continue ;
164
+ }
165
+ $ values [$ key ] = $ item ->get ();
166
+
167
+ if (!$ metadata = $ item ->getMetadata ()) {
168
+ continue ;
169
+ }
170
+ unset($ metadata [CacheItem::METADATA_TAGS ]);
171
+
172
+ if ($ metadata ) {
173
+ $ values [$ key ] = array ("\x9D" .pack ('VN ' , (int ) $ metadata [CacheItem::METADATA_EXPIRY ] - self ::METADATA_EXPIRY_OFFSET , $ metadata [CacheItem::METADATA_CTIME ])."\x5F" => $ values [$ key ]);
174
+ }
152
175
}
153
176
154
177
return $ values ;
0 commit comments