cachekit

package
v0.0.0-...-413ad06 Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2025 License: AGPL-3.0 Imports: 10 Imported by: 3

Documentation

Index

Constants

View Source
const (
	DAAttachment = "attachment"
	DAUser       = "account"
	DARealm      = "realm"
)

Those constants are used to directly get the cached data from redis Formatted like {prefix}#{key}

Variables

This section is empty.

Functions

func Delete

func Delete(c *Conn, key string) error

func DeleteByTags

func DeleteByTags(c *Conn, tags ...string) error

func FKey

func FKey(prefix string, key any) string

func Get

func Get[T any](c *Conn, key string) (T, error)

func Set

func Set[T any](c *Conn, key string, value T, ttl time.Duration, tags ...string) error

func SetKA

func SetKA[T any](c *Conn, key string, value T, tags ...string) error

SetKA stands for Set Keep Alive Don't set a TTL for the value set via this function

Types

type Conn

type Conn struct {
	Rd      *redis.Client
	Timeout time.Duration
	// contains filtered or unexported fields
}

func NewConn

func NewConn(conn *nex.Conn, timeout time.Duration) (*Conn, error)

func (*Conn) GoCache

func (c *Conn) GoCache() *redis_store.RedisStore

func (*Conn) RDelete

func (c *Conn) RDelete(key string) error

Delete removes a key from Redis

func (*Conn) RDeleteByPrefix

func (c *Conn) RDeleteByPrefix(prefix string) error

ClearCacheByPrefix deletes all keys matching a given prefix

func (*Conn) RExists

func (c *Conn) RExists(key string) (bool, error)

Exists checks if a key exists in Redis

func (*Conn) RGet

func (c *Conn) RGet(key string) (string, error)

Get retrieves a value from Redis by key

func (*Conn) RSet

func (c *Conn) RSet(key string, value any, ttl time.Duration) error

Set stores a key-value pair in Redis with an optional expiration time

Jump to

Keyboard shortcuts

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