mirror of
https://github.com/gofiber/storage.git
synced 2025-10-04 16:22:52 +08:00
📦 Fix expiration checks
Affects memory, postgres and sqlite3 drivers
This commit is contained in:
@@ -43,8 +43,7 @@ func (s *Storage) Get(key string) ([]byte, error) {
|
|||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
if v.expiry < time.Now().Unix() && v.expiry != 0 {
|
if v.expiry <= time.Now().Unix() && v.expiry != 0 {
|
||||||
_ = s.Delete(key)
|
|
||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -118,7 +118,7 @@ func (s *Storage) Get(key string) ([]byte, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// If the expiration time has already passed, then return nil
|
// If the expiration time has already passed, then return nil
|
||||||
if time.Now().After(time.Unix(exp, 0)) {
|
if exp <= time.Now().Unix() && exp != 0 {
|
||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -109,7 +109,7 @@ func (s *Storage) Get(key string) ([]byte, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// If the expiration time has already passed, then return nil
|
// If the expiration time has already passed, then return nil
|
||||||
if time.Now().After(time.Unix(exp, 0)) {
|
if exp <= time.Now().Unix() && exp != 0 {
|
||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user