storage

package
v1.6.0 Latest Latest
Warning

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

Go to latest
Published: Jun 27, 2022 License: MPL-2.0 Imports: 10 Imported by: 1

Documentation

Index

Constants

View Source
const (
	RedisKeyPrefix          string = "analytics-"
	ANALYTICS_KEYNAME       string = "tyk-system-analytics"
	UptimeAnalytics_KEYNAME string = "tyk-uptime-analytics"
)

Variables

View Source
var AvailableStores map[string]AnalyticsStorage
View Source
var ENV_REDIS_PREFIX = "TYK_PMP_REDIS"

Functions

func NewRedisClusterPool

func NewRedisClusterPool(forceReconnect bool, config RedisStorageConfig) redis.UniversalClient

Types

type AnalyticsStorage

type AnalyticsStorage interface {
	Init(config interface{}) error
	GetName() string
	Connect() bool
	GetAndDeleteSet(setName string, chunkSize int64, expire time.Duration) []interface{}
}

type EnvMapString

type EnvMapString map[string]string

func (*EnvMapString) Decode

func (e *EnvMapString) Decode(value string) error

type RedisClusterStorageManager

type RedisClusterStorageManager struct {
	KeyPrefix string
	HashKeys  bool
	Config    RedisStorageConfig
	// contains filtered or unexported fields
}

RedisClusterStorageManager is a storage manager that uses the redis database.

func (*RedisClusterStorageManager) Connect

func (r *RedisClusterStorageManager) Connect() bool

Connect will establish a connection to the r.db

func (*RedisClusterStorageManager) GetAndDeleteSet

func (r *RedisClusterStorageManager) GetAndDeleteSet(keyName string, chunkSize int64, expire time.Duration) []interface{}

func (*RedisClusterStorageManager) GetName

func (r *RedisClusterStorageManager) GetName() string

func (*RedisClusterStorageManager) Init

func (r *RedisClusterStorageManager) Init(config interface{}) error

func (*RedisClusterStorageManager) SetExp

func (r *RedisClusterStorageManager) SetExp(keyName string, timeout int64) error

func (*RedisClusterStorageManager) SetKey

func (r *RedisClusterStorageManager) SetKey(keyName, session string, timeout int64) error

SetKey will create (or update) a key value in the store

type RedisStorageConfig

type RedisStorageConfig struct {
	// Deprecated.
	Type string `json:"type" mapstructure:"type"`
	// Redis host value.
	Host string `json:"host" mapstructure:"host"`
	// Redis port value.
	Port int `json:"port" mapstructure:"port"`
	// Deprecated. Use Addrs instead.
	Hosts EnvMapString `json:"hosts" mapstructure:"hosts"`
	// Use instead of the host value if you're running a redis cluster with mutliple instances.
	Addrs []string `json:"addrs" mapstructure:"addrs"`
	// Sentinel redis master name.
	MasterName string `json:"master_name" mapstructure:"master_name"`
	// Sentinel redis password.
	SentinelPassword string `json:"sentinel_password" mapstructure:"sentinel_password"`
	// Redis username.
	Username string `json:"username" mapstructure:"username"`
	// Redis password.
	Password string `json:"password" mapstructure:"password"`
	// Redis database.
	Database int `json:"database" mapstructure:"database"`
	// How long to allow for new connections to be established (in milliseconds). Defaults to 5sec.
	Timeout int `json:"timeout" mapstructure:"timeout"`
	// Maximum number of idle connections in the pool.
	MaxIdle int `json:"optimisation_max_idle" mapstructure:"optimisation_max_idle"`
	// Maximum number of connections allocated by the pool at a given time. When zero, there is no
	// limit on the number of connections in the pool. Defaults to 500.
	MaxActive int `json:"optimisation_max_active" mapstructure:"optimisation_max_active"`
	// Enable this option if you are using a redis cluster. Default is `false`.
	EnableCluster bool `json:"enable_cluster" mapstructure:"enable_cluster"`
	// Prefix the redis key names. Defaults to "analytics-".
	RedisKeyPrefix string `json:"redis_key_prefix" mapstructure:"redis_key_prefix"`
	// Setting this to true to use SSL when connecting to Redis.
	RedisUseSSL bool `json:"redis_use_ssl" mapstructure:"redis_use_ssl"`
	// Set this to `true` to tell Pump to ignore Redis' cert validation.
	RedisSSLInsecureSkipVerify bool `json:"redis_ssl_insecure_skip_verify" mapstructure:"redis_ssl_insecure_skip_verify"`
}

Jump to

Keyboard shortcuts

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