cache

package
v0.13.1 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2022 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BigCacheClient

type BigCacheClient interface {
	Get(key string) ([]byte, error)
	Set(key string, entry []byte) error
	Delete(key string) error
	Reset() error
}

type BigCacheStore

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

func (*BigCacheStore) Clear

func (s *BigCacheStore) Clear() error

func (*BigCacheStore) Delete

func (s *BigCacheStore) Delete(key string) error

func (*BigCacheStore) Get

func (s *BigCacheStore) Get(key string) ([]byte, error)

func (*BigCacheStore) Set

func (s *BigCacheStore) Set(key string, value []byte, _ time.Duration) error

type Cache

type Cache struct {
	TTL time.Duration
	// contains filtered or unexported fields
}

func NewBigCache

func NewBigCache(config bigcache.Config) (*Cache, error)

Creates a new Cache using BigCache Requires a BigCache config that can be created with bigcache.DefaultConfig(n*time.Minute)

func NewRedis

func NewRedis(ctx context.Context, options *redis.Options, ttl time.Duration) (*Cache, error)

Creates a new Cache using go-redis

func (*Cache) Clear

func (c *Cache) Clear() error

func (*Cache) Delete

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

func (*Cache) Get

func (c *Cache) Get(key string) ([]byte, error)

func (*Cache) Set

func (c *Cache) Set(key string, object []byte) error

type RedisClient

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

type RedisStore

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

func (*RedisStore) Clear

func (s *RedisStore) Clear() error

func (*RedisStore) Delete

func (s *RedisStore) Delete(key string) error

func (*RedisStore) Get

func (s *RedisStore) Get(key string) ([]byte, error)

func (*RedisStore) Set

func (s *RedisStore) Set(key string, value []byte, ttl time.Duration) error

type Store

type Store interface {
	Get(key string) ([]byte, error)
	Set(key string, value []byte, ttl time.Duration) error
	Delete(key string) error
	Clear() error
}

Jump to

Keyboard shortcuts

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