📦 Fix expiration checks

Affects memory, postgres and sqlite3 drivers
This commit is contained in:
Tom
2020-11-01 13:33:57 +00:00
parent fa1e1591bb
commit 23a3640cfb
3 changed files with 3 additions and 4 deletions

View File

@@ -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
} }

View File

@@ -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
} }

View File

@@ -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
} }