增加获取缓存实例的方法

This commit is contained in:
2024-06-21 14:58:49 +08:00
parent 4b82877f85
commit 225a1ae9b2
3 changed files with 32 additions and 1 deletions

29
common.go Normal file
View File

@ -0,0 +1,29 @@
// Package cache ...
//
// Description : cache ...
//
// Author : go_developer@163.com<白茶清欢>
//
// Date : 2024-06-21 14:55
package cache
import (
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
}
return nil
}