feat: 增加空缓存实现的支持

This commit is contained in:
2026-01-05 09:54:02 +08:00
parent 1fcb129079
commit 1fb1215a9c
6 changed files with 66 additions and 18 deletions

View File

@@ -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
}