1
0
mirror of https://github.com/charlienet/go-mixed.git synced 2025-07-18 08:32:40 +08:00
This commit is contained in:
2022-06-10 17:04:34 +08:00
parent 853b19fb02
commit 9bb232be93
22 changed files with 641 additions and 147 deletions

12
cache/free_cache.go vendored
View File

@ -4,6 +4,7 @@ import (
"errors"
"time"
"github.com/charlienet/go-mixed/bytesconv"
"github.com/coocood/freecache"
)
@ -37,10 +38,13 @@ func (c *freeCache) Set(key string, value []byte, d time.Duration) error {
return c.cache.Set([]byte(key), value, s)
}
func (c *freeCache) Delete(key string) error {
affected := c.cache.Del([]byte(key))
if !affected {
return errors.New("不存在")
func (c *freeCache) Delete(keys ...string) error {
for _, k := range keys {
affected := c.cache.Del(bytesconv.StringToBytes(k))
if !affected {
return errors.New("不存在")
}
}
return nil