diff --git a/memory/memory.go b/memory/memory.go index 112c522d..f381436c 100644 --- a/memory/memory.go +++ b/memory/memory.go @@ -43,8 +43,7 @@ func (s *Storage) Get(key string) ([]byte, error) { return nil, nil } - if v.expiry < time.Now().Unix() && v.expiry != 0 { - _ = s.Delete(key) + if v.expiry <= time.Now().Unix() && v.expiry != 0 { return nil, nil } diff --git a/postgres/postgres.go b/postgres/postgres.go index afb665ed..a76e9f82 100644 --- a/postgres/postgres.go +++ b/postgres/postgres.go @@ -118,7 +118,7 @@ func (s *Storage) Get(key string) ([]byte, error) { } // 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 } diff --git a/sqlite3/sqlite3.go b/sqlite3/sqlite3.go index c0d6edf3..1077d547 100644 --- a/sqlite3/sqlite3.go +++ b/sqlite3/sqlite3.go @@ -109,7 +109,7 @@ func (s *Storage) Get(key string) ([]byte, error) { } // 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 }