📦 SQLite: Fix no expiration check on Set

This commit is contained in:
Tom
2020-11-01 14:32:17 +00:00
parent 6fdd3455f1
commit f686d97dc8

View File

@@ -118,7 +118,11 @@ func (s *Storage) Get(key string) ([]byte, error) {
// Set key with value
func (s *Storage) Set(key string, val []byte, exp time.Duration) error {
_, err := s.db.Exec(s.sqlInsert, key, utils.UnsafeString(val), time.Now().Add(exp).Unix())
var expSeconds int64
if exp != 0 {
expSeconds = time.Now().Add(exp).Unix()
}
_, err := s.db.Exec(s.sqlInsert, key, utils.UnsafeString(val), expSeconds)
return err
}