mirror of
https://gitee.com/dromara/mayfly-go
synced 2025-12-09 17:30:25 +08:00
feat: 机器新增备注字段,其他优化
This commit is contained in:
@@ -126,7 +126,7 @@ func (r *redisAppImpl) GetRedisInstance(id uint64) *RedisInstance {
|
||||
var redisCache = cache.NewTimedCache(30*time.Minute, 5*time.Second).
|
||||
WithUpdateAccessTime(true).
|
||||
OnEvicted(func(key interface{}, value interface{}) {
|
||||
global.Log.Info(fmt.Sprintf("删除redis连接缓存 id: %d", key))
|
||||
global.Log.Info(fmt.Sprintf("删除redis连接缓存 id = %d", key))
|
||||
value.(*RedisInstance).Cli.Close()
|
||||
})
|
||||
|
||||
@@ -137,12 +137,9 @@ type RedisInstance struct {
|
||||
Cli *redis.Client
|
||||
}
|
||||
|
||||
// 关闭redis连接
|
||||
// 移除redis连接缓存并关闭redis连接
|
||||
func CloseRedis(id uint64) {
|
||||
if load, ok := redisCache.Get(id); ok {
|
||||
load.(*RedisInstance).Cli.Close()
|
||||
redisCache.Delete(id)
|
||||
}
|
||||
redisCache.Delete(id)
|
||||
}
|
||||
|
||||
func TestRedisConnection(re *entity.Redis) {
|
||||
|
||||
Reference in New Issue
Block a user