cache

package
v0.2.5 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CloseRedisCache

func CloseRedisCache()

func CloseRistrettoCache

func CloseRistrettoCache()

func GetKey

func GetKey(slugs ...string) string

func InitRedisCache

func InitRedisCache(opts *RedisCacheOpts)

func InitRistrettoCache

func InitRistrettoCache(cost int64, counters int64)

Types

type Cache

type Cache interface {
	Set(context.Context, string, interface{}, time.Duration) bool
	Get(context.Context, string) (interface{}, bool)
	GetStruct(context.Context, string, interface{}) bool
	Exists(context.Context, string) bool
}

func NewRedisCache

func NewRedisCache() Cache

func NewRistrettoCache

func NewRistrettoCache() Cache

type RedisCacheOpts

type RedisCacheOpts struct {
	DB                    int
	Host                  string
	Password              string
	MaxIdleConnection     int
	MaxActiveConnection   int
	IdleConnectionTimeout time.Duration
	MaxConnectionLifetime time.Duration
}

Jump to

Keyboard shortcuts

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