leafCache

package module
v0.0.0-...-358b5b9 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2022 License: MIT Imports: 4 Imported by: 0

README

Cache

Documentation

Index

Constants

View Source
const Forever = 87660 * time.Hour
View Source
const Infinite = math.MaxInt32

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

type Cache interface {
	Ping(ctx context.Context) error
	Close() error
	Remove(ctx context.Context, key string) error
}

type Memcache

type Memcache interface {
	Cache

	Len(ctx context.Context) int
	Size(ctx context.Context) uintptr
	Keys(ctx context.Context) []string

	Set(ctx context.Context, key string, value interface{}, ttl time.Duration) error
	Get(ctx context.Context, key string) (interface{}, error)

	Remove(ctx context.Context, key string) error
	Truncate(ctx context.Context) error
}

func NoopMemcache

func NoopMemcache() Memcache

type Redis

type Redis interface {
	Cache
	Keys(ctx context.Context, pattern string) ([]string, error)

	Get(ctx context.Context, key string, data encoding.BinaryUnmarshaler) error
	Set(ctx context.Context, key string, value encoding.BinaryMarshaler) error
	SetWithExpiration(ctx context.Context, key string, value encoding.BinaryMarshaler, duration time.Duration) error

	HGetAll(ctx context.Context, key string) (map[string]string, error)
	HMGet(ctx context.Context, key string, fields ...string) ([]interface{}, error)
	HMSet(ctx context.Context, key string, value map[string]interface{}) error
	HMSetWithExpiration(ctx context.Context, key string, value map[string]interface{}, ttl time.Duration) error
	HGet(ctx context.Context, key string, field string, response encoding.BinaryUnmarshaler) error
	HSet(ctx context.Context, key string, field string, value interface{}) error
	HSetWithExpiration(ctx context.Context, key string, field string, value interface{}, ttl time.Duration) error
	MGet(ctx context.Context, key []string) ([]interface{}, error)

	Remove(ctx context.Context, key string) error
	RemoveByPattern(ctx context.Context, pattern string, countPerLoop int64) error
	FlushDatabase(ctx context.Context) error
	FlushAll(ctx context.Context) error
}

func NoopRedis

func NoopRedis() Redis

Jump to

Keyboard shortcuts

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