storage

package
v0.8.5 Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2020 License: MPL-2.0 Imports: 9 Imported by: 0

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(string) []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) []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 RedisOpts

type RedisOpts redis.UniversalOptions

RedisOpts is the overriden type of redis.UniversalOptions. simple() and cluster() functions are not public in redis library. Therefore, they are redefined in here to use in creation of new redis cluster logic. We don't want to use redis.NewUniversalClient() logic.

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"`
	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