diff --git a/memcache/memcache.go b/memcache/memcache.go index 5ce43648..cab3a5b0 100644 --- a/memcache/memcache.go +++ b/memcache/memcache.go @@ -72,6 +72,10 @@ func (s *Storage) Get(key string) ([]byte, error) { // Set key with value func (s *Storage) Set(key string, val []byte, exp time.Duration) error { + // Ain't Nobody Got Time For That + if len(val) <= 0 { + return nil + } item := s.acquireItem() item.Key = key item.Value = val diff --git a/memory/memory.go b/memory/memory.go index 6a0a3195..86bfe1b2 100644 --- a/memory/memory.go +++ b/memory/memory.go @@ -52,6 +52,10 @@ func (s *Storage) Get(key string) ([]byte, error) { // Set key with value func (s *Storage) Set(key string, val []byte, exp time.Duration) error { + // Ain't Nobody Got Time For That + if len(val) <= 0 { + return nil + } var expire int64 if exp != 0 { expire = time.Now().Add(exp).Unix() diff --git a/mongodb/mongodb.go b/mongodb/mongodb.go index 8e9a9012..5faca20a 100644 --- a/mongodb/mongodb.go +++ b/mongodb/mongodb.go @@ -127,6 +127,11 @@ func (s *Storage) Get(key string) ([]byte, error) { // // document will be remove automatically if exp is set, based on MongoDB TTL Indexes func (s *Storage) Set(key string, val []byte, exp time.Duration) error { + // Ain't Nobody Got Time For That + if len(val) <= 0 { + return nil + } + filter := bson.M{"key": key} item := s.acquireItem() item.Key = key diff --git a/mysql/mysql.go b/mysql/mysql.go index 5d39be46..7e553ab9 100644 --- a/mysql/mysql.go +++ b/mysql/mysql.go @@ -118,6 +118,10 @@ func (s *Storage) Get(key string) ([]byte, error) { // Set key with value func (s *Storage) Set(key string, val []byte, exp time.Duration) error { + // Ain't Nobody Got Time For That + if len(val) <= 0 { + return nil + } var expSeconds int64 if exp != 0 { expSeconds = time.Now().Add(exp).Unix() diff --git a/postgres/postgres.go b/postgres/postgres.go index de7ee7d3..369f12b4 100644 --- a/postgres/postgres.go +++ b/postgres/postgres.go @@ -138,6 +138,10 @@ func (s *Storage) Get(key string) ([]byte, error) { // Set key with value func (s *Storage) Set(key string, val []byte, exp time.Duration) error { + // Ain't Nobody Got Time For That + if len(val) <= 0 { + return nil + } _, err := s.db.Exec(s.sqlInsert, key, utils.UnsafeString(val), time.Now().Add(exp).Unix()) return err } diff --git a/redis/redis.go b/redis/redis.go index 7b7ffb8a..86497adb 100644 --- a/redis/redis.go +++ b/redis/redis.go @@ -59,6 +59,10 @@ func (s *Storage) Get(key string) ([]byte, error) { // Set key with value func (s *Storage) Set(key string, val []byte, exp time.Duration) error { + // Ain't Nobody Got Time For That + if len(val) <= 0 { + return nil + } return s.db.Set(context.Background(), key, val, exp).Err() } diff --git a/sqlite3/fiber.sqlite3 b/sqlite3/fiber.sqlite3 deleted file mode 100644 index df1ff749..00000000 Binary files a/sqlite3/fiber.sqlite3 and /dev/null differ diff --git a/sqlite3/sqlite3.go b/sqlite3/sqlite3.go index dab712db..c31f0162 100644 --- a/sqlite3/sqlite3.go +++ b/sqlite3/sqlite3.go @@ -117,6 +117,10 @@ func (s *Storage) Get(key string) ([]byte, error) { // Set key with value func (s *Storage) Set(key string, val []byte, exp time.Duration) error { + // Ain't Nobody Got Time For That + if len(val) <= 0 { + return nil + } var expSeconds int64 if exp != 0 { expSeconds = time.Now().Add(exp).Unix()