storage

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2021 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 {
	Type                       string       `mapstructure:"type"`
	Host                       string       `mapstructure:"host"`
	Port                       int          `mapstructure:"port"`
	Hosts                      EnvMapString `mapstructure:"hosts"` // Deprecated: Use Addrs instead.
	Addrs                      []string     `mapstructure:"addrs"`
	MasterName                 string       `mapstructure:"master_name" json:"master_name"`
	SentinelPassword           string       `mapstructure:"sentinel_password" json:"sentinel_password"`
	Username                   string       `mapstructure:"username"`
	Password                   string       `mapstructure:"password"`
	Database                   int          `mapstructure:"database"`
	Timeout                    int          `mapstructure:"timeout"`
	MaxIdle                    int          `mapstructure:"optimisation_max_idle" json:"optimisation_max_idle"`
	MaxActive                  int          `mapstructure:"optimisation_max_active" json:"optimisation_max_active"`
	EnableCluster              bool         `mapstructure:"enable_cluster" json:"enable_cluster"`
	RedisKeyPrefix             string       `mapstructure:"redis_key_prefix" json:"redis_key_prefix"`
	RedisUseSSL                bool         `mapstructure:"redis_use_ssl" json:"redis_use_ssl"`
	RedisSSLInsecureSkipVerify bool         `mapstructure:"redis_ssl_insecure_skip_verify" json:"redis_ssl_insecure_skip_verify"`
}

Jump to

Keyboard shortcuts

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