wrappers

package
v0.0.0-...-035f276 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2022 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewFreeCacheInMem

func NewFreeCacheInMem(configuration *FreeCacheInMemWrapperCacheConfiguration) *freecache.Cache

NewFreeCacheInMem is Ctor for FreeCacheInMemWrapperCache

Types

type FreeCacheInMemWrapperCacheConfiguration

type FreeCacheInMemWrapperCacheConfiguration struct {
	// CacheSize in bytes.
	CacheSize int
}

FreeCacheInMemWrapperCacheConfiguration is the configuration for FreeCacheInMemCache.

type IFreeCacheInMemCacheWrapper

type IFreeCacheInMemCacheWrapper interface {

	// Set sets a key, value and expiration for a cache entry and stores it in the cache.
	// If the key is larger than 65535 or value is larger than 1/1024 of the cache size,
	// the entry will not be written to the cache. expireSeconds <= 0 means no expire,
	// but it can be evicted when cache is full.
	Set(key, value []byte, expireSeconds int) (err error)
	// Get returns the value or not found error.
	Get(key []byte) (value []byte, err error)
}

IFreeCacheInMemCacheWrapper is a wrapper interface for base client of redis - "github.com/coocood/freecache"

type IRedisBaseClientWrapper

type IRedisBaseClientWrapper interface {
	// Set Redis `SET key value [expiration]` command.
	// Use expiration for `SETEX`-like behavior.
	// Zero expiration means the key has no expiration time.
	Set(ctx context.Context, key string, value interface{}, expiration time.Duration) *redis.StatusCmd

	// Get Redis `GET key` command. It returns redis.Nil error when key does not exist.
	Get(ctx context.Context, key string) *redis.StringCmd

	// Ping Redis Ping command. it is used to test if a connection is still alive, or to measure latency.
	// returns redis.Nil error if unsuccessfully received a pong from the server.
	// returns ('PONG', nil) if successfully received a pong from the server
	Ping(ctx context.Context) *redis.StatusCmd
}

IRedisBaseClientWrapper is a wrapper interface for base client of redis - "github.com/go-redis/redis"

type RedisCacheClientConfiguration

type RedisCacheClientConfiguration struct {
	// Address is host:port address. For example azure-defender-proxy-redis-service:6379
	Address string
	// Host address
	Host string
	// Password Optional password. Must match the password specified in the
	// requirement pass server configuration option.
	PasswordPath string
	// TlsCrt is the path to the tls.crt file
	TlsCrtPath string
	// TlsKey is the path to the tls.key file
	TlsKeyPath string
	// CaCert is the path to the ca.cert file
	CaCertPath string
	// Table is Database to be selected after connecting to the server.
	Table int
	// MaxRetries Maximum number of retries before giving up.
	// Default is to not retry failed commands.
	MaxRetries int
	// MinRetryBackoff Minimum backoff between each retry.
	// Default is 8 milliseconds; -1 disables backoff.
	MinRetryBackoff time.Duration
	// HeartbeatFrequency is the frequency **in minutes** for validating the redis connection
	HeartbeatFrequency int
}

RedisCacheClientConfiguration redis cache client configuration

type WrapperRedisClientFactory

type WrapperRedisClientFactory struct {
	// contains filtered or unexported fields
}

WrapperRedisClientFactory is a factory for WrapperRedisClient.

func NewWrapperRedisClientFactory

func NewWrapperRedisClientFactory(instrumentationProvider instrumentation.IInstrumentationProvider) *WrapperRedisClientFactory

NewWrapperRedisClientFactory constructor

func (*WrapperRedisClientFactory) Create

func (factory *WrapperRedisClientFactory) Create(configuration *RedisCacheClientConfiguration) (*redis.Client, error)

Create creates redis client by getting RedisCacheClientConfiguration and extracting the certificates and password. TODO use only CA bundle and Server DNS + Password to Authenticate

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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