增加获取缓存实例的方法
This commit is contained in:
29
common.go
Normal file
29
common.go
Normal 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
|
||||
}
|
Reference in New Issue
Block a user