txorm

package
v0.0.0-...-ac0283c Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	DefaultDelChan = "teco_xorm_del_cache"
)

Variables

View Source
var (
	ErrNotExist = errors.New("record does not exist")
)

Functions

This section is empty.

Types

type MemoryStore

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

MemoryStore represents in-memory store

func NewMemoryStore

func NewMemoryStore(r *redis.Client, printDebugLog bool, delChan ...string) *MemoryStore

NewMemoryStore creates a new store in memory

func (*MemoryStore) Del

func (s *MemoryStore) Del(key string) error

Del deletes object

func (*MemoryStore) Get

func (s *MemoryStore) Get(key string) (interface{}, error)

Get gets object from store

func (*MemoryStore) Put

func (s *MemoryStore) Put(key string, value interface{}) error

Put puts object into store

type RedisCache

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

RedisCache 是一个实现 Xorm Cacher 接口的结构体

func NewRedisCache

func NewRedisCache(client *redis.Client, ttl time.Duration, printDebugLog bool) *RedisCache

NewRedisCache 创建一个新的 RedisCache 实例

func (*RedisCache) Del

func (c *RedisCache) Del(key string) error

Del 删除缓存

func (*RedisCache) Get

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

Get 获取缓存

func (*RedisCache) Put

func (c *RedisCache) Put(key string, value interface{}) error

Put 放入缓存

Jump to

Keyboard shortcuts

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