storage

package
v0.0.0-...-4db2772 Latest Latest
Warning

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

Go to latest
Published: Jun 1, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const DEFAULT_EXPIRATION_TIME = 5 * time.Minute
View Source
const Nil = StorageError("toggles: Flag not found") // nolint:errname

Variables

This section is empty.

Functions

This section is empty.

Types

type CacheClient

type CacheClient interface {
	KeyValueStore
	Set(key string, value any, expiration time.Duration) error
	Expire(key string, expiration time.Duration) error
	GetList(key string) ([]string, error)
	AppendToList(key string, expiration time.Duration, values ...any) error
	RemoveFromList(key string, values ...any) error
}

func NewRedisClient

func NewRedisClient(host string, port uint) CacheClient

type KeyValueDBClient

type KeyValueDBClient interface {
	KeyValueStore
	Set(key string, value any) error
}

type KeyValueStore

type KeyValueStore interface {
	Get(key string) (string, error)
	Delete(key string) error
	Keys() ([]string, error)
	Exists(name string) (bool, error)
}

type RedisClient

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

func (RedisClient) AppendToList

func (r RedisClient) AppendToList(key string, expiration time.Duration, values ...any) error

func (RedisClient) Delete

func (r RedisClient) Delete(key string) error

func (RedisClient) Exists

func (r RedisClient) Exists(name string) (bool, error)

func (RedisClient) Expire

func (r RedisClient) Expire(key string, expiration time.Duration) error

func (RedisClient) Get

func (r RedisClient) Get(key string) (string, error)

func (RedisClient) GetList

func (r RedisClient) GetList(key string) ([]string, error)

func (RedisClient) Keys

func (r RedisClient) Keys() ([]string, error)

func (RedisClient) RemoveFromList

func (r RedisClient) RemoveFromList(key string, values ...any) error

func (RedisClient) Set

func (r RedisClient) Set(key string, value any, expiration time.Duration) error

type StorageError

type StorageError string

////////// Errors //////////

func (StorageError) Error

func (e StorageError) Error() string

Jump to

Keyboard shortcuts

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