Documentation ¶
Index ¶
- Constants
- func IsConnectionError(err error) bool
- func NewFailoverOptions(sURL string, db int, logger zerolog.Logger, reconnectCount int, ...) (*redis.FailoverOptions, error)
- func NewOptions(surl string, db int, logger zerolog.Logger, reconnectCount int, ...) (*redis.Options, error)
- func NewSession(ctx context.Context, db int, logger zerolog.Logger, reconnectCount int, ...) (*redis.Client, error)
- type Lock
- type LockClient
Constants ¶
const ( KeyDelimiter = "$$" RunInfoKey = "engine-run-info" PbehaviorPeriodicalLockKey = "pbehavior-periodical-lock-key" PbehaviorCleanPeriodicalLockKey = "pbehavior-clean-periodical-lock-key" RecomputeLockKey = "pbehavior-recompute-lock-key" RecomputeLockDuration = 10 * time.Second ActionPeriodicalLockKey = "action-periodical-lock-key" ActionDelayedScenarioKey = "action-delayed-scenario" ActionScenarioExecutionKey = "action-scenario-execution" AxePeriodicalLockKey = "axe-periodical-lock-key" AxeResolvedArchiverPeriodicalLockKey = "axe-resolved-archiver-periodical-lock-key" AxeInternalTagsPeriodicalLockKey = "axe-internal-tags-periodical-lock-key" AxeEntityServiceStateLockKey = "axe-entity-service-state-lock-key" AxeIdleSincePeriodicalLockKey = "axe-idle-since-periodical-lock-key" AxeNotAckedMetricsPeriodicalLockKey = "axe-not-acked-metrics-periodical-lock-key" AxeSliMetricsPeriodicalLockKey = "axe-sli-metrics-periodical-lock-key" AxeCleanExternalTagsPeriodicalLockKey = "axe-clean-external-tags-periodical-lock-key" FifoDeleteOutdatedRatesLockKey = "fifo-delete-outdated-rates-lock-key" ChePeriodicalLockKey = "che-periodical-lock-key" CheSoftDeletePeriodicalLockKey = "che-soft-delete-periodical-lock-key" CheEntityInfosDictionaryPeriodicalLockKey = "che-entity-infos-dictionary-periodical-lock-key" CheEventFiltersIntervalsPeriodicalLockKey = "che-event-filters-intervals-periodical-lock-key" RecorderLockKey = "recorder-lock-key" RecorderDeleteOutdatedRecordingsLockKey = "recorder-delete-outdated-recordings-lock-key" RemediationPeriodicalLockKey = "remediation-periodical-lock-key" RemediationStatsPeriodicalLockKey = "remediation-stats-periodical-lock-key" RemediationPostponedJobTasksLockKey = "remediation-postponed-job-tasks-lock-key" PbehaviorSpanKey = "pbehavior-span" PbehaviorTypesKey = "pbehavior-types" PbehaviorDefaultActiveTypeKey = "pbehavior-default-active-type" PbehaviorComputedKey = "pbehavior-computed-" DynamicInfosDictionaryPeriodicalLockKey = "dynamic-infos-dictionary-periodical-lock-key" ApiCleanEntitiesLockKey = "api-clean-entities-lock-key" ApiUserActivityMetricLockKey = "api-user-activity-metric" ApiCacheRequestKey = "api-cache-request" ApiActionLogWatchLockKey = "api-action-log-watch-lock-key" CorrelationInactiveDelayPeriodicalLockKey = "correlation-inactive-delay-periodical-lock-key" )
const ( CacheAlarm = iota CacheEntity CacheService LockStorage QueueStorage ApiCacheQueue AxePeriodicalLockStorage RuleTotalEntitiesStorage AlarmGroupStorage CorrelationLockStorage EngineRunInfo PBehaviorLockStorage ActionScenarioStorage EntityServiceStorage FIFOMessageStatisticsStorage // EngineLockStorage is used for all redis locks. It should be used by all engines. EngineLockStorage )
Cache<Type> gives you constants to use for different caches.
const (
EnvURL = "CPS_REDIS_URL"
)
Env vars for redis session
Variables ¶
This section is empty.
Functions ¶
func NewFailoverOptions ¶
func NewFailoverOptions(sURL string, db int, logger zerolog.Logger, reconnectCount int, minReconnectTimeout time.Duration) (*redis.FailoverOptions, error)
NewFailoverOptions handles redis.FailoverOptions creation based on the provided url, which must be on the following shape:
redis-sentinel://[password@]host1[:port1][,host2[:port2]][,hostN[:portN]][/database][?
[timeout=timeout[d|h|m|s|ms|us|ns]][&sentinelMasterId=sentinelMasterId]]
As well supported password parameter same as in NewOptions():
redis://[nouser:password@]host:port/int
With this form "nouser" is ignored, and "password" extracted only.
func NewOptions ¶
func NewOptions(surl string, db int, logger zerolog.Logger, reconnectCount int, minReconnectTimeout time.Duration) (*redis.Options, error)
NewOptions handles redis.Options creation based on the surl, which must be on the following shape:
redis://[nouser:password@]host:port/int int must be un number indicating the database
If you have a password for the database, no user is required. But it is required to not leave the user empty to avoid url parsing error.