cache

package
v0.0.0-...-1e80932 Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

type Cache interface {
	Get(key string) (string, error)
	Set(key string, value string, expiration time.Duration) error
	GenerateCacheKey(r *http.Request) string
	Increment(key string, window time.Duration) (int64, error)
}

type CacheConfig

type CacheConfig struct {
	Addr     string
	Password string
}

type RedisCache

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

func NewRedisCache

func NewRedisCache(cfg CacheConfig) *RedisCache

func (*RedisCache) GenerateCacheKey

func (r *RedisCache) GenerateCacheKey(rq *http.Request) string

func (*RedisCache) Get

func (r *RedisCache) Get(key string) (string, error)

func (*RedisCache) Increment

func (r *RedisCache) Increment(key string, window time.Duration) (int64, error)

func (*RedisCache) Set

func (r *RedisCache) Set(key string, value string, expiration time.Duration) error

Jump to

Keyboard shortcuts

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