cache

package
v0.0.0-...-d6feb86 Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

type Memory

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

func NewMemory

func NewMemory() *Memory

func (*Memory) Get

func (c *Memory) Get(_ context.Context, key string, val any) error

func (*Memory) Has

func (c *Memory) Has(ctx context.Context, key string) (bool, error)

func (*Memory) Keys

func (c *Memory) Keys(ctx context.Context, pattern string) ([]string, error)

Keys will return the set of keys in the cache matching the given "*" based pattern. WARNING: This implementation only supports a single wildcard.

func (*Memory) Set

func (c *Memory) Set(ctx context.Context, key string, val any, ttl time.Duration) error

Set will create a cache file for the given key. TODO: Support TTL based expirations

type Redis

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

func NewRedis

func NewRedis(addr string) *Redis

NewRedis instantiates a new client

func NewRedisSecureCache

func NewRedisSecureCache(host, port, user, password string, db int) *Redis

NewRedisSecureCache instantiates a new secure TLS client

func (*Redis) Get

func (c *Redis) Get(ctx context.Context, key string, val any) error

func (*Redis) Has

func (c *Redis) Has(ctx context.Context, key string) (bool, error)

func (*Redis) Keys

func (c *Redis) Keys(ctx context.Context, pattern string) ([]string, error)

func (*Redis) Set

func (c *Redis) Set(ctx context.Context, key string, val any, ttl time.Duration) error

Jump to

Keyboard shortcuts

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