Commit f1486e03 authored by luxq's avatar luxq

add del

parent db603768
...@@ -2,6 +2,7 @@ package cachedata ...@@ -2,6 +2,7 @@ package cachedata
import ( import (
"encoding/json" "encoding/json"
"github.com/gomodule/redigo/redis"
"github.com/odysseus/cache/model" "github.com/odysseus/cache/model"
"strings" "strings"
) )
...@@ -56,3 +57,12 @@ func (c *CacheData) SetWhiteListToRedis(wh *model.Whitelist) error { ...@@ -56,3 +57,12 @@ func (c *CacheData) SetWhiteListToRedis(wh *model.Whitelist) error {
return err return err
} }
} }
func (c *CacheData) DeleteWhiteList(wh *model.Whitelist) error {
whKey := "wh-a-" + strings.ToLower(wh.Character)
if err := c.rdb.Del(c.ctx, whKey).Err(); err == nil || err == redis.ErrNil {
return nil
} else {
return err
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment