cache

package
v0.0.0-...-ed7ff26 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	NoExpiration      = -1
	DefaultExpiration = 0
)

Variables

View Source
var (
	ErrorKeyNotFound = errors.New("key not found")
)

Functions

This section is empty.

Types

type Cache

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

func NewCache

func NewCache(ctx context.Context, r *redis.Redis, defaultExpiration time.Duration, janitorInterval time.Duration) *Cache

func (*Cache) Delete

func (c *Cache) Delete(key string) error

func (*Cache) DeleteExpired

func (c *Cache) DeleteExpired()

func (*Cache) Get

func (c *Cache) Get(key string) (interface{}, error)

func (*Cache) Set

func (c *Cache) Set(key string, val interface{}, d time.Duration) error

func (*Cache) SetDefault

func (c *Cache) SetDefault(key string, val interface{}) error

type Item

type Item struct {
	Value      interface{}
	Expiration int64
}

Jump to

Keyboard shortcuts

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