mirror of
https://github.com/gofiber/storage.git
synced 2025-10-05 16:48:25 +08:00
📦 SQLite: Fix no expiration check on Set
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user