cache

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2026 License: MIT Imports: 7 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithExpiry added in v0.51.0

func WithExpiry(expiry time.Duration) cache.Option

WithExpiry returns a func to customize an Options with given expiry.

func WithNotFoundExpiry added in v0.51.0

func WithNotFoundExpiry(expiry time.Duration) cache.Option

WithNotFoundExpiry returns a func to customize an Options with given not found expiry.

Types

type Cache

type Cache interface {
	cache.Cache

	// SetNoExpireCtx Because zero cache set ctx has default expire, so jzero add this method
	SetNoExpireCtx(ctx context.Context, key string, val any) error

	// GetPrefixKeysCtx get prefix key, give prefix key return all matched key
	GetPrefixKeysCtx(ctx context.Context, prefix string) ([]string, error)

	// ExpireCtx set key expire
	ExpireCtx(ctx context.Context, key string, expire time.Duration) error
}

func NewRedisNode

func NewRedisNode(rds *redis.Redis, errNotFound error, opts ...cache.Option) Cache

func NewRedisNodeWithCachePrefix added in v0.60.0

func NewRedisNodeWithCachePrefix(rds *redis.Redis, errNotFound error, cachePrefix string, opts ...cache.Option) Cache

NewRedisNodeWithCachePrefix returns a cacheNode configured for Redis usage with cache prefix.

Jump to

Keyboard shortcuts

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