feat: 增加空缓存实现的支持
This commit is contained in:
12
common.go
12
common.go
@@ -8,22 +8,22 @@
|
||||
package cache
|
||||
|
||||
import (
|
||||
"strings"
|
||||
|
||||
cacheAbstract "git.zhangdeman.cn/zhangdeman/cache/abstract"
|
||||
"git.zhangdeman.cn/zhangdeman/consts"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// GetCacheInstance 获取缓存实例
|
||||
//
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
//
|
||||
// Date : 14:56 2024/6/21
|
||||
func GetCacheInstance(cacheDriver string) cacheAbstract.ICache {
|
||||
switch strings.ToLower(cacheDriver) {
|
||||
case consts.CacheDriverRedis:
|
||||
return RedisClient
|
||||
case consts.CacheDriverGocache:
|
||||
return GocacheClient
|
||||
case consts.CacherDriverNull:
|
||||
return DefaultClient
|
||||
}
|
||||
return nil
|
||||
// 非法驱动统一默认空实现
|
||||
return DefaultClient
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user