rediscache

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithKeyGenerator

func WithKeyGenerator(keyGenerator key.KeyGenerator) keyGeneratorOption

func WithLocalCache

func WithLocalCache(localCache cache.LocalCache) localCacheOption

Types

type CacheEngine

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

func New

func New(redisCli RedisClient, opts ...Option) *CacheEngine

func (*CacheEngine) Get

func (e *CacheEngine) Get(ctx context.Context, key string, req *http.Request) (*http.Response, bool, error)

func (*CacheEngine) Key

func (e *CacheEngine) Key(req *http.Request) (key string, err error)

func (*CacheEngine) Set

func (e *CacheEngine) Set(ctx context.Context, key string, res *http.Response, ttl time.Duration) error

type Option

type Option interface {
	// contains filtered or unexported methods
}

type RedisClient

type RedisClient interface {
	Set(ctx context.Context, key string, value any, ttl time.Duration) *redis.StatusCmd
	SetXX(ctx context.Context, key string, value any, ttl time.Duration) *redis.BoolCmd
	SetNX(ctx context.Context, key string, value any, ttl time.Duration) *redis.BoolCmd
	Get(ctx context.Context, key string) *redis.StringCmd
	Del(ctx context.Context, keys ...string) *redis.IntCmd
}

Jump to

Keyboard shortcuts

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