cache

package
v0.0.0-...-264f9d0 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2024 License: GPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MemoryCache

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

func NewMemoryCache

func NewMemoryCache(size int) (*MemoryCache, error)

func (*MemoryCache) Close

func (c *MemoryCache) Close() error

Always returns nil.

func (*MemoryCache) Collectors

func (c *MemoryCache) Collectors() []prometheus.Collector

func (*MemoryCache) Get

func (c *MemoryCache) Get(k []byte) (v pool.Buffer, storedTime, expireTime time.Time)

func (*MemoryCache) Store

func (c *MemoryCache) Store(k []byte, storedTime, expireTime time.Time, v []byte, setNX bool)

type RedisCache

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

func NewRedisCache

func NewRedisCache(u string, logger *zerolog.Logger) (*RedisCache, error)

func (*RedisCache) AsyncStore

func (c *RedisCache) AsyncStore(k []byte, storedTime, expireTime time.Time, v []byte, setNX bool)

Store v in to redis asynchronously.

func (*RedisCache) Close

func (c *RedisCache) Close() error

Always returns nil.

func (*RedisCache) Collectors

func (c *RedisCache) Collectors() []prometheus.Collector

func (*RedisCache) Get

func (c *RedisCache) Get(ctx context.Context, k []byte) (storedTime, expireTime time.Time, v []byte)

Get dose not return error. All errors (of broking/invalid stored data, connection lost, etc.) will be logged.

Jump to

Keyboard shortcuts

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