cache

package
v0.0.0-...-462c6ef Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

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

Functions

func Init

func Init()

Types

type Cache

type Cache interface {
	Ping() error
	HSet(key, field string, value interface{}) error
	HGet(key, field string) (string, error)
	HGetAll(key string) (map[string]string, error)
	HDel(key string, fields ...string) (int64, error)
	Del(key string) (int64, error)
	Keys(pattern string) ([]string, error)
	FlushDB() error
}
var Store Cache

type MemoryCache

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

func NewMemoryCache

func NewMemoryCache() *MemoryCache

func (*MemoryCache) Del

func (m *MemoryCache) Del(key string) (int64, error)

func (*MemoryCache) FlushDB

func (m *MemoryCache) FlushDB() error

func (*MemoryCache) HDel

func (m *MemoryCache) HDel(key string, fields ...string) (int64, error)

func (*MemoryCache) HGet

func (m *MemoryCache) HGet(key, field string) (string, error)

func (*MemoryCache) HGetAll

func (m *MemoryCache) HGetAll(key string) (map[string]string, error)

func (*MemoryCache) HSet

func (m *MemoryCache) HSet(key, field string, value interface{}) error

func (*MemoryCache) Keys

func (m *MemoryCache) Keys(pattern string) ([]string, error)

func (*MemoryCache) Ping

func (m *MemoryCache) Ping() error

type RedisCache

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

func NewRedisCache

func NewRedisCache() *RedisCache

func (*RedisCache) Del

func (r *RedisCache) Del(key string) (int64, error)

func (*RedisCache) FlushDB

func (r *RedisCache) FlushDB() error

func (*RedisCache) HDel

func (r *RedisCache) HDel(key string, fields ...string) (int64, error)

func (*RedisCache) HGet

func (r *RedisCache) HGet(key, field string) (string, error)

func (*RedisCache) HGetAll

func (r *RedisCache) HGetAll(key string) (map[string]string, error)

func (*RedisCache) HSet

func (r *RedisCache) HSet(key, field string, value interface{}) error

func (*RedisCache) Keys

func (r *RedisCache) Keys(pattern string) ([]string, error)

func (*RedisCache) Ping

func (r *RedisCache) Ping() error

Jump to

Keyboard shortcuts

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