99 * with this source code in the file LICENSE.
1010 */
1111
12-
1312namespace Cache \Adapter \Filesystem ;
1413
1514use Cache \Adapter \Common \AbstractCachePool ;
1615use Cache \Adapter \Common \Exception \InvalidArgumentException ;
16+ use Cache \Adapter \Common \PhpCacheItem ;
1717use Cache \Taggable \TaggableItemInterface ;
1818use Cache \Taggable \TaggablePoolInterface ;
1919use Cache \Taggable \TaggablePoolTrait ;
@@ -66,7 +66,7 @@ public function setFolder($folder)
6666 */
6767 protected function fetchObjectFromCache ($ key )
6868 {
69- $ empty = [false , null , []];
69+ $ empty = [false , null , [], null ];
7070 $ file = $ this ->getFilePath ($ key );
7171 if (!$ this ->filesystem ->has ($ file )) {
7272 return $ empty ;
@@ -78,18 +78,18 @@ protected function fetchObjectFromCache($key)
7878 return $ empty ;
7979 }
8080
81- // Determine ttl from data, remove items if expired
82- $ ttl = $ data [0 ] ?: null ;
83- if ($ ttl !== null && time () > $ ttl ) {
84- foreach ($ data [2 ] as $ tag ) {
81+ // Determine expirationTimestamp from data, remove items if expired
82+ $ expirationTimestamp = $ data [2 ] ?: null ;
83+ if ($ expirationTimestamp !== null && time () > $ expirationTimestamp ) {
84+ foreach ($ data [1 ] as $ tag ) {
8585 $ this ->removeListItem ($ this ->getTagKey ($ tag ), $ key );
8686 }
8787 $ this ->forceClear ($ key );
8888
8989 return $ empty ;
9090 }
9191
92- return [true , $ data [1 ], $ data [2 ], $ ttl ];
92+ return [true , $ data [0 ], $ data [1 ], $ expirationTimestamp ];
9393 }
9494
9595 /**
@@ -116,7 +116,7 @@ protected function clearOneObjectFromCache($key)
116116 /**
117117 * {@inheritdoc}
118118 */
119- protected function storeItemInCache (CacheItemInterface $ item , $ ttl )
119+ protected function storeItemInCache (PhpCacheItem $ item , $ ttl )
120120 {
121121 $ tags = [];
122122 if ($ item instanceof TaggableItemInterface) {
@@ -125,9 +125,9 @@ protected function storeItemInCache(CacheItemInterface $item, $ttl)
125125
126126 $ data = serialize (
127127 [
128- ($ ttl === null ? null : time () + $ ttl ),
129128 $ item ->get (),
130129 $ tags ,
130+ $ item ->getExpirationTimestamp (),
131131 ]
132132 );
133133
0 commit comments