fixes issue #425 (#438)

This commit is contained in:
Kevin Wan
2021-02-05 13:32:56 +08:00
committed by GitHub
parent 7b3c3de35e
commit b88ba14597
6 changed files with 32 additions and 17 deletions

View File

@@ -14,6 +14,7 @@ type (
Cache interface {
DelCache(keys ...string) error
GetCache(key string, v interface{}) error
IsNotFound(err error) bool
SetCache(key string, v interface{}) error
SetCacheWithExpire(key string, v interface{}, expire time.Duration) error
Take(v interface{}, key string, query func(v interface{}) error) error
@@ -91,6 +92,10 @@ func (cc cacheCluster) GetCache(key string, v interface{}) error {
return c.(Cache).GetCache(key, v)
}
func (cc cacheCluster) IsNotFound(err error) bool {
return err == cc.errNotFound
}
func (cc cacheCluster) SetCache(key string, v interface{}) error {
c, ok := cc.dispatcher.Get(key)
if !ok {