cache

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2025 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewMemCache

func NewMemCache[T any]() *cache.Cache[T]

func NewRedisCache

func NewRedisCache[T any]() *cache.Cache[T]

func SetRedis

func SetRedis(redisOpt RedisOptions)

Types

type Cache

type Cache[T any] struct {
	// contains filtered or unexported fields
}

func New

func New[V any](c *cache.Cache[[]byte]) *Cache[V]

func (*Cache[T]) Clear

func (c *Cache[T]) Clear(ctx context.Context) error

func (*Cache[T]) Delete

func (c *Cache[T]) Delete(ctx context.Context, key string) error

func (*Cache[T]) Get

func (c *Cache[T]) Get(ctx context.Context, key string) (*T, error)

func (*Cache[T]) Set

func (c *Cache[T]) Set(ctx context.Context, key string, val T) error

type CacheOptions

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

type MultiKeyCache

type MultiKeyCache[V MultiKeyObject] struct {
	// contains filtered or unexported fields
}

func NewMultiKeyCache

func NewMultiKeyCache[V MultiKeyObject](c cache.Cache[V]) *MultiKeyCache[V]

func (*MultiKeyCache[V]) Delete

func (m *MultiKeyCache[V]) Delete(ctx context.Context, key string) error

func (*MultiKeyCache[V]) Get

func (m *MultiKeyCache[V]) Get(ctx context.Context, key string) (V, error)

func (*MultiKeyCache[V]) Set

func (m *MultiKeyCache[V]) Set(ctx context.Context, value V) error

type MultiKeyObject

type MultiKeyObject interface {
	GetKeys() []string
}

type RedisOptions

type RedisOptions struct {
	Username string
	Password string
	Addr     string
	DB       int
	TLS      *TLS
}

func (*RedisOptions) GetGoRedisOptions

func (o *RedisOptions) GetGoRedisOptions() *goredis.Options

type TLS

type TLS struct {
	KeyPath  string
	CertPath string
	CaPath   string
}

func (*TLS) GetTLSConfig

func (t *TLS) GetTLSConfig() (*tls.Config, error)

Jump to

Keyboard shortcuts

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