cache

package
v0.0.11 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewRedisClient

func NewRedisClient(cfg common.RedisConfig, environment string) (*redis.Client, error)

NewRedisClient creates a new Redis client instance.

Types

type Cache

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

Cache provides get/set operations backed by Redis.

func New

func New(client *redis.Client) *Cache

New creates a new Cache instance.

func (*Cache) Get

func (c *Cache) Get(ctx context.Context, key string) (json.RawMessage, error)

Get returns the cached value for key, or nil on miss.

func (*Cache) HasFlag added in v0.0.10

func (c *Cache) HasFlag(ctx context.Context, key string) (bool, error)

HasFlag returns true if the flag key exists in cache.

func (*Cache) Set

func (c *Cache) Set(ctx context.Context, key string, data json.RawMessage, ttl time.Duration) error

Set stores data under key with the given TTL.

func (*Cache) SetFlag added in v0.0.10

func (c *Cache) SetFlag(ctx context.Context, key string, ttl time.Duration) error

SetFlag stores a flag key with the given TTL (value is irrelevant).

Jump to

Keyboard shortcuts

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