diff --git a/mysql/mysql.go b/mysql/mysql.go index 75e43502..0558907d 100644 --- a/mysql/mysql.go +++ b/mysql/mysql.go @@ -109,8 +109,8 @@ func (s *Storage) Get(key string) ([]byte, error) { } // If the expiration time has already passed, then return nil - if exp <= time.Now().Unix() && exp != 0 { - return nil, nil + if exp != 0 && exp <= time.Now().Unix() { + return nil, ErrNotExist } return data, nil diff --git a/postgres/postgres.go b/postgres/postgres.go index abbb8d17..b20859f0 100644 --- a/postgres/postgres.go +++ b/postgres/postgres.go @@ -129,8 +129,8 @@ func (s *Storage) Get(key string) ([]byte, error) { } // If the expiration time has already passed, then return nil - if exp <= time.Now().Unix() && exp != 0 { - return nil, nil + if exp != 0 && exp <= time.Now().Unix() { + return nil, ErrNotExist } return data, nil