Documentation ¶
Index ¶
- func CloseRedisCli()
- func DeleteCacheFromRedisMessage(msg *redis.Message)
- func GetCacheCli() *cache.Cache
- func GetInternetAddress() (ip string, err error)
- func GetRedisCli() *redis.Client
- func GetRedisSubPool() *redisSubscriptionPool
- func Go(f func())
- func GoWithGroup(f func() error) (func() error, context.Context)
- func InitDefaultLog()
- func InitLog(opts *LoggerOptions)
- func PingRedis(ctx context.Context) (string, bool)
- func RegisteDeleteCache(channel string)
- type LoggerOptions
- type LoggerWrapper
- type StringSet
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CloseRedisCli ¶
func CloseRedisCli()
func DeleteCacheFromRedisMessage ¶
func DeleteCacheFromRedisMessage(msg *redis.Message)
DeleteCacheFromRedisMessage 根据redis订阅消息清空内存缓存
func GetCacheCli ¶
func GetCacheCli() *cache.Cache
func GetInternetAddress ¶
GetInternetAddress 获取网络IP
func GetRedisCli ¶
func GetRedisCli() *redis.Client
func GoWithGroup ¶
GoWithGroup 使用 errgroup 创建 goroutine
func RegisteDeleteCache ¶
func RegisteDeleteCache(channel string)
RegisteDeleteCache 从redis中订阅清空内存缓存 假如订阅事件已存在,则什么都不做 异步注册,避免获取订阅连接时影响业务逻辑性能
Types ¶
type LoggerOptions ¶
type LoggerWrapper ¶
type LoggerWrapper struct { // 日志结构体,可以输出 结构化日志 *zap.Logger // sugarLogger 日志结构体,可以输出 结构化日志、非结构化日志 S *zap.SugaredLogger // contains filtered or unexported fields }
func (LoggerWrapper) GetErrorWriter ¶
func (l LoggerWrapper) GetErrorWriter() io.Writer
func (LoggerWrapper) GetWriter ¶
func (l LoggerWrapper) GetWriter() io.Writer
func (*LoggerWrapper) SyncAndClose ¶
func (l *LoggerWrapper) SyncAndClose() (err error)
SyncAndClose 刷新 logger 缓冲区,并关闭写入对象
type StringSet ¶
type StringSet map[string]struct{}
func NewSetFromSlice ¶
NewSetFromSlice 根据数组生成一个set结构的数据集合 即使数组长度为空也会返回一个可用的空集合
func (StringSet) Intersection ¶
Intersection 与传入字符串数组是否存在交集
func (*StringSet) MarshalJSON ¶
MarshalJSON 将set集合序列化为array结构的Json数据
func (*StringSet) UnmarshalJSON ¶
UnmarshalJSON 将array结构的Json数据反序列化为set结构
Source Files ¶
Click to show internal directories.
Click to hide internal directories.