inmemory

package
v0.3.5 Latest Latest
Warning

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

Go to latest
Published: May 17, 2024 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Scan

func Scan(b []byte, v interface{}) error

Scan parses bytes `b` to `v` with appropriate type.

func ScanSlice

func ScanSlice(data []string, slice interface{}) error

func ValidProvider

func ValidProvider(v string) bool

Types

type Manager

type Manager interface {
	MustConnect(ctx context.Context) Manager
	Connect(ctx context.Context) error

	Set(ctx context.Context, key string, value interface{}) error
	SetWhenNotExist(ctx context.Context, key string, value interface{}) error
	SetWithExpire(ctx context.Context, key string, value interface{}, expire time.Duration) error
	SetWithExpireWhenNotExist(ctx context.Context, key string, value interface{}, expire time.Duration) error
	SetString(ctx context.Context, key, value string, expire time.Duration) error
	Get(ctx context.Context, key string, bindTo interface{}) error
	GetString(ctx context.Context, key string) string
	Del(ctx context.Context, keys ...string) error

	HSet(ctx context.Context, key string, value ...interface{}) error
	HSetWhenNotExist(ctx context.Context, key, field string, value interface{}) error
	HGet(ctx context.Context, key, field string, bindTo interface{}) error
	HDel(ctx context.Context, key string, fields ...string) error
	HGetAll(ctx context.Context, key string, bindTo interface{}) error

	HMSet(ctx context.Context, key string, values ...interface{}) error
	HMGet(ctx context.Context, key, field string, bindTo interface{}) error

	Ping() error
}

func NewNoop

func NewNoop() Manager

func NewRedis

func NewRedis(addr string, opts ...Option[redisManager]) Manager

func NewValKey

func NewValKey(addr string, opts ...Option[valkeyManager]) Manager

type Option

type Option[T any] interface {
	// contains filtered or unexported methods
}

func NewRedisOptions

func NewRedisOptions() []Option[redisManager]

func NewValKeyOptions

func NewValKeyOptions() []Option[valkeyManager]

func RedisWithDB

func RedisWithDB(v int) Option[redisManager]

func RedisWithPassword

func RedisWithPassword(v string) Option[redisManager]

func RedisWithPrefix

func RedisWithPrefix(v string) Option[redisManager]

func RedisWithScope

func RedisWithScope(v string) Option[redisManager]

func RedisWithTLSB64

func RedisWithTLSB64(v bool, certB64, keyB64, serverName string) Option[redisManager]

func RedisWithTLSFile

func RedisWithTLSFile(v bool, certFile, keyFile, serverName string) Option[redisManager]

func RedisWithTelemetry

func RedisWithTelemetry(tm telemetry.Manager) Option[redisManager]

func ValKeyWithDB

func ValKeyWithDB(v int) Option[valkeyManager]

func ValKeyWithPassword

func ValKeyWithPassword(v string) Option[valkeyManager]

func ValKeyWithPrefix

func ValKeyWithPrefix(prefix string) Option[valkeyManager]

func ValKeyWithScope

func ValKeyWithScope(v string) Option[valkeyManager]

func ValKeyWithTLSB64

func ValKeyWithTLSB64(v bool, certB64, keyB64, serverName string) Option[valkeyManager]

func ValKeyWithTLSFile

func ValKeyWithTLSFile(v bool, certFile, keyFile, serverName string) Option[valkeyManager]

func ValKeyWithTelemetry

func ValKeyWithTelemetry(v telemetry.Manager) Option[valkeyManager]

type Provider

type Provider string
const (
	ProviderValKey Provider = "valkey"
	ProviderRedis  Provider = "redis"
)

func (Provider) String

func (p Provider) String() string

Jump to

Keyboard shortcuts

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