xorm-redis-cache icon indicating copy to clipboard operation
xorm-redis-cache copied to clipboard

删除缓存卡顿的问题

Open god1991 opened this issue 6 years ago • 3 comments

func (c *RedisCacher) delObjects(key string) error {

c.logDebugf("delObjects key:[%s]", key)

conn := c.pool.Get()
defer conn.Close()

keys, err := conn.Do("KEYS", key)
c.logDebugf("delObjects keys: %v", keys)

if err == nil {
	for _, key := range keys.([]interface{}) {
		conn.Do("DEL", key)
	}
}
return err

}

删除的时候用到了keys命令,db里面的key比较多的时候会导致卡顿,可以改成scan嘛?

此外,这个redis缓存好久不更新了,有生成使用的例子嘛?

god1991 avatar May 30 '19 03:05 god1991

Could you send a PR to fix that?

lunny avatar May 30 '19 14:05 lunny

I try it

god1991 avatar May 31 '19 15:05 god1991

#8

god1991 avatar Jun 04 '19 10:06 god1991