save code
This commit is contained in:
37
apply/cache.go
Normal file
37
apply/cache.go
Normal file
@ -0,0 +1,37 @@
|
||||
// Package apply ...
|
||||
//
|
||||
// Description : apply ...
|
||||
//
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
//
|
||||
// Date : 2023-02-13 11:24
|
||||
package apply
|
||||
|
||||
import (
|
||||
"git.zhangdeman.cn/zhangdeman/redis"
|
||||
)
|
||||
|
||||
var (
|
||||
// Cache 数据缓存的场景
|
||||
Cache *cache
|
||||
)
|
||||
|
||||
type cache struct {
|
||||
}
|
||||
|
||||
// Set 设置缓存
|
||||
//
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
//
|
||||
// Date : 11:28 2023/2/13
|
||||
func (c *cache) Set(ctx *redis.Context, key string, value interface{}) error {
|
||||
var (
|
||||
err error
|
||||
rc *redis.RealClient
|
||||
)
|
||||
|
||||
if rc, err = redis.Client.GetRedisClient(ctx.Flag); nil != err {
|
||||
return err
|
||||
}
|
||||
return rc.Master.Set(nil, key, value, -1).Err()
|
||||
}
|
Reference in New Issue
Block a user