libpack_cache_redis

package
v0.34.7 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2025 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CacheWrapper added in v0.29.1

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

CacheWrapper wraps RedisConfig to implement the CacheClient interface without returning errors, for backward compatibility

func NewCacheWrapper added in v0.29.1

func NewCacheWrapper(config *RedisConfig, logger *libpack_logger.Logger) *CacheWrapper

NewCacheWrapper creates a new cache wrapper

func (*CacheWrapper) Clear added in v0.29.1

func (w *CacheWrapper) Clear()

Clear removes all keys

func (*CacheWrapper) CountQueries added in v0.29.1

func (w *CacheWrapper) CountQueries() int64

CountQueries returns the number of queries

func (*CacheWrapper) Delete added in v0.29.1

func (w *CacheWrapper) Delete(key string)

Delete removes a key

func (*CacheWrapper) Get added in v0.29.1

func (w *CacheWrapper) Get(key string) ([]byte, bool)

Get retrieves a value

func (*CacheWrapper) GetMaxMemorySize added in v0.29.1

func (w *CacheWrapper) GetMaxMemorySize() int64

GetMaxMemorySize returns 0 for Redis (not applicable)

func (*CacheWrapper) GetMemoryUsage added in v0.29.1

func (w *CacheWrapper) GetMemoryUsage() int64

GetMemoryUsage returns 0 for Redis (not applicable)

func (*CacheWrapper) Set added in v0.29.1

func (w *CacheWrapper) Set(key string, value []byte, ttl time.Duration)

Set stores a value with the given TTL

type RedisClientConfig

type RedisClientConfig struct {
	RedisServer   string
	RedisPassword string
	Prefix        string
	RedisDB       int
}

type RedisConfig

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

func New added in v0.18.7

func New(redisClientConfig *RedisClientConfig) (*RedisConfig, error)

func (*RedisConfig) Clear

func (c *RedisConfig) Clear() error

func (*RedisConfig) CountQueries

func (c *RedisConfig) CountQueries() (int64, error)

func (*RedisConfig) CountQueriesWithPattern

func (c *RedisConfig) CountQueriesWithPattern(pattern string) (int, error)

func (*RedisConfig) Delete

func (c *RedisConfig) Delete(key string) error

func (*RedisConfig) Get

func (c *RedisConfig) Get(key string) ([]byte, bool, error)

func (*RedisConfig) GetMaxMemorySize added in v0.29.1

func (c *RedisConfig) GetMaxMemorySize() int64

GetMaxMemorySize returns the configured max memory for Redis In Redis, this would be the 'maxmemory' configuration value

func (*RedisConfig) GetMemoryUsage added in v0.29.1

func (c *RedisConfig) GetMemoryUsage() int64

GetMemoryUsage returns an approximation of memory usage for Redis For Redis, this is not as accurate as the memory cache implementation as actual memory is managed by Redis server

func (*RedisConfig) Set

func (c *RedisConfig) Set(key string, value []byte, ttl time.Duration) error

Jump to

Keyboard shortcuts

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