File tree Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -43,8 +43,7 @@ public function fetch($key)
4343 public function save ($ key , CacheEntry $ data )
4444 {
4545 try {
46- // getTTL returns seconds, Laravel needs minutes
47- $ lifeTime = $ data ->getTTL () / 60 ;
46+ $ lifeTime = $ this ->getLifeTime ($ data );
4847 if ($ lifeTime === 0 ) {
4948 return $ this ->cache ->forever (
5049 $ key ,
@@ -71,4 +70,15 @@ public function delete($key)
7170 {
7271 return $ this ->cache ->forget ($ key );
7372 }
73+
74+ protected function getLifeTime (CacheEntry $ data )
75+ {
76+ $ version = app ()->version ();
77+ if (preg_match ('/^\d+(\.\d+)?(\.\d+)?/ ' , $ version ) && version_compare ($ version , '5.8.0 ' ) < 0 ) {
78+ // getTTL returns seconds, Laravel needs minutes before v5.8
79+ return $ data ->getTTL () / 60 ;
80+ }
81+
82+ return $ data ->getTTL ();
83+ }
7484}
You can’t perform that action at this time.
0 commit comments