cache

package
v0.0.1-202406260927 Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Memory

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

func NewMemory

func NewMemory() *Memory

NewMemory memory模式

func (*Memory) AddList

func (m *Memory) AddList(key string, values ...interface{}) error

func (*Memory) Append

func (m *Memory) Append(key string, values ...interface{}) error

func (*Memory) Decrease

func (m *Memory) Decrease(key string) error

func (*Memory) Del

func (m *Memory) Del(key string) error

func (*Memory) Expire

func (m *Memory) Expire(key string, dur time.Duration) error

func (*Memory) Get

func (m *Memory) Get(key string) (string, error)

func (*Memory) GetList

func (m *Memory) GetList(key string) ([]string, error)

func (*Memory) GetPrefix

func (m *Memory) GetPrefix(key string, length ...int) ([]string, error)

func (*Memory) HashDel

func (m *Memory) HashDel(hk, key string) error

func (*Memory) HashGet

func (m *Memory) HashGet(hk, key string) (string, error)

func (*Memory) HashGetAll

func (m *Memory) HashGetAll(hk string) (map[string]string, error)

func (*Memory) HashSet

func (m *Memory) HashSet(hk string, value interface{}, expire int) error

func (*Memory) HashSetField

func (m *Memory) HashSetField(hk, key string, value interface{}) error

func (*Memory) Increase

func (m *Memory) Increase(key string) error

func (*Memory) Set

func (m *Memory) Set(key string, val interface{}, expire int) error

func (*Memory) String

func (*Memory) String() string

type Redis

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

Redis cache implement

func NewRedis

func NewRedis(client *redis.Client, options *redis.Options) (*Redis, error)

NewRedis redis模式

func (*Redis) AddList

func (r *Redis) AddList(key string, values ...interface{}) error

func (*Redis) Append

func (r *Redis) Append(key string, values ...interface{}) error

func (*Redis) Decrease

func (r *Redis) Decrease(key string) error

func (*Redis) Del

func (r *Redis) Del(key string) error

Del delete key in redis

func (*Redis) Expire

func (r *Redis) Expire(key string, dur time.Duration) error

Set ttl

func (*Redis) Get

func (r *Redis) Get(key string) (string, error)

Get from key

func (*Redis) GetClient

func (r *Redis) GetClient() *redis.Client

GetClient 暴露原生client

func (*Redis) GetList

func (r *Redis) GetList(key string) ([]string, error)

func (*Redis) GetPrefix

func (r *Redis) GetPrefix(key string, length ...int) ([]string, error)

func (*Redis) HashDel

func (r *Redis) HashDel(hk, key string) error

HashDel delete key in specify redis's hashtable

func (*Redis) HashGet

func (r *Redis) HashGet(hk, key string) (string, error)

HashGet from key

func (*Redis) HashGetAll

func (r *Redis) HashGetAll(hk string) (map[string]string, error)

func (*Redis) HashSet

func (r *Redis) HashSet(hk string, value interface{}, expire int) error

func (*Redis) HashSetField

func (r *Redis) HashSetField(hk, key string, value interface{}) error

func (*Redis) Increase

func (r *Redis) Increase(key string) error

Increase

func (*Redis) Set

func (r *Redis) Set(key string, val interface{}, expire int) error

Set value with key and expire time

func (*Redis) String

func (*Redis) String() string

Jump to

Keyboard shortcuts

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