multi_level_cache.go
669 字节
package cache
import (
"github.com/tiptok/gocomm/pkg/cache"
"github.com/tiptok/gocomm/pkg/cache/gzcache"
"github.com/tiptok/gocomm/pkg/log"
"github.com/zeromicro/go-zero/core/logx"
)
func NewMultiLevelCache(hosts []string, password string) *cache.MultiLevelCache {
logx.Infof("starting multi level cache...")
mlCache := cache.NewMultiLevelCacheNew(cache.WithDebugLog(true, func() log.Log {
return log.DefaultLog
}))
mlCache.RegisterCache(gzcache.NewClusterCache(hosts, password))
return mlCache
}
func NewCachedRepository(c *cache.MultiLevelCache, options ...cache.QueryOption) *cache.CachedRepository {
return cache.NewCachedRepository(c, options...)
}