1
0
mirror of https://github.com/astaxie/beego.git synced 2025-07-10 14:01:03 +00:00

add UT for Scan function

This commit is contained in:
huija
2020-06-19 22:55:40 +08:00
parent 40181c1042
commit f2bae3e367
2 changed files with 40 additions and 2 deletions

View File

@ -137,12 +137,12 @@ func (rc *Cache) Decr(key string) error {
// ClearAll clean all cache in redis. delete this redis collection.
func (rc *Cache) ClearAll() error {
c := rc.p.Get()
defer c.Close()
cachedKeys, err := rc.Scan(rc.key + ":*")
if err != nil {
return err
}
c := rc.p.Get()
defer c.Close()
for _, str := range cachedKeys {
if _, err = c.Do("DEL", str); err != nil {
return err