redi

package
v0.0.0-...-a9119a5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 18, 2022 License: Apache-2.0, Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	HostKey          = "host"           //
	MonitoredHostKey = "monitored_host" //
)
View Source
const (
	GroupPluginsLockKey    = "GroupPluginsLock"
	GroupTemplatesLockKey  = "GroupTemplatesLock"
	HostGroupsMapLockKey   = "HostGroupsMapLock"
	HostMapLockKey         = "HostMapLock"
	TemplateCacheLockKey   = "TemplateCacheLock"
	StrategiesLockKey      = "StrategiesLock"
	HostTemplateIdsLockKey = "HostTemplateIdsLock"
	ExpressionCacheLockKey = "ExpressionCacheLock"
	MonitoredHostsLockKey  = "MonitoredHostsLock"
	DynamicConfigLockKey   = "DynamicConfigLock"
	HostServiceIdsLockKey  = "HostServiceIdsLockKey"

	RedisDisTLockTimeOut = 55

	GroupPluginsWLockKey    = "GroupPluginsWLock"
	GroupTemplatesWLockKey  = "GroupTemplatesWLock"
	HostGroupsMapWLockKey   = "HostGroupsMapWLock"
	HostMapWLockKey         = "HostMapWLock"
	TemplateCacheWLockKey   = "TemplateCacheWLock"
	StrategiesWLockKey      = "StrategiesWLock"
	HostTemplateIdsWLockKey = "HostTemplateIdsWLock"
	ExpressionCacheWLockKey = "ExpressionCacheWLock"
	MonitoredHostsWLockKey  = "MonitoredHostsWLock"
	DynamicConfigWLockKey   = "DynamicConfigWLock"
	HostServiceIdsWLockKey  = "HostServiceIdsLockKey"
)
View Source
const (
	TemplateKey     = "template" //
	TPLKey          = "tpl"      //
	HostTemplateKey = "host_template"
)
View Source
const DynamicConfigKey = "dynamic_config" //
View Source
const ExpressionsKey = "expressions"
View Source
const GroupKeyPerfix = "group" //
View Source
const HostServiceKey = "host_Service"
View Source
const LockKey = "lock"
View Source
const PluginKey = "plugin" //
View Source
const SEP = "|||"
View Source
const StrategiesKey = "strategies" //
View Source
const TIMEOUT = 60 * 20
View Source
const UnionStrategiesKey = "union_strategies"

Variables

View Source
var RedisCluster *redis.Cluster

Functions

func GetDynamicConfigRedis

func GetDynamicConfigRedis() (map[string][]*model.DynamicConfig, error)

从redis中获取hash map

func GetExpressionsFromRedis

func GetExpressionsFromRedis() ([]*model.Expression, error)

从redis中获取hash map

func GetGroupTemplateFromRedis

func GetGroupTemplateFromRedis() (map[int][]int, error)

从redis中获取hash map

func GetHostFromRedis

func GetHostFromRedis() (map[string]int, error)

从redis中获取hash map

func GetHostGroupFromRedis

func GetHostGroupFromRedis() (map[int][]int, error)

从redis中获取hash map

func GetHostServiceFromRedis

func GetHostServiceFromRedis() (map[string]string, error)

从redis中获取hash map

func GetHostTemplateFromRedis

func GetHostTemplateFromRedis() (map[int][]int, error)

从redis中获取hash map

func GetLock

func GetLock(LockKey string, Timeout int64) bool

获取redis分布式锁

func GetMonitoredHostFromRedis

func GetMonitoredHostFromRedis() (map[int]*model.Host, error)

从redis中获取hash map

func GetPluginsFromRedis

func GetPluginsFromRedis() (map[int][]string, error)

从redis中获取hash map

func GetStrategiesFromRedis

func GetStrategiesFromRedis() (map[int]*model.Strategy, error)

从redis中获取hash map

func GetTPLFromRedis

func GetTPLFromRedis() (map[int]*model.Template, error)

从redis中获取hash map

func GetUnionStrategiesFromRedis

func GetUnionStrategiesFromRedis() (map[int][]*model.Strategy, error)

func Init

func Init()

初始化redis集群

func SetDynamicConfig2Redis

func SetDynamicConfig2Redis(m map[string][]*model.DynamicConfig)

设置插件map到redis hash,数量级10,直接设置hash

func SetExpressions2Redis

func SetExpressions2Redis(m []*model.Expression)

设置插件map到redis hash,数量级10,直接设置hash

func SetGroupTemplate2Redis

func SetGroupTemplate2Redis(m map[int][]int)

设置插件map到redis hash,数量级10,直接设置hash

func SetHost2Redis

func SetHost2Redis(m map[string]int)

设置插件map到redis hash,数量级10,直接设置hash

func SetHostGroup2Redis

func SetHostGroup2Redis(m map[int][]int)

设置插件map到redis hash,数量级10,直接设置hash

func SetHostService2Redis

func SetHostService2Redis(m map[string]string)

func SetHostTemplate2Redis

func SetHostTemplate2Redis(m map[int][]int)

func SetMonitoredHost2Redis

func SetMonitoredHost2Redis(m map[int]*model.Host)

设置插件map到redis hash,数量级10,直接设置hash

func SetPlugins2Redis

func SetPlugins2Redis(m map[int][]string)

设置插件map到redis hash,数量级10,直接设置hash

func SetStrategies2Redis

func SetStrategies2Redis(m map[int]*model.Strategy)

设置插件map到redis hash,数量级10,直接设置hash

func SetTPL2Redis

func SetTPL2Redis(m map[int]*model.Template)

func SetUnionStrategies2Redis

func SetUnionStrategies2Redis(m map[int][]*model.Strategy)

func WLock

func WLock(LockKey string, Timeout int64) error

加写锁

func WUnlock

func WUnlock(LockKey string)

解锁

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL