cache

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: May 14, 2021 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Adapter

type Adapter interface {
	Connect() error
	Get(key string) (string, error)
	Set(key string, value interface{}, expire int) error
	Del(key string) error
	HashGet(hashKey, key string) error
	HashSet(hashKey string, value ...interface{}) error
	HashSetNX(hashKey, field string, value interface{}) error
	HashMSet(hashKey string, value ...interface{}) error
	HashDel(hashKey, key string) error
	Increase(key string) error
	Decrease(key string) error
	Expire(key string, duration time.Duration) error

	AdapterQueue
}

type AdapterQueue

type AdapterQueue interface {
	Append(name string, message Message) error
	Register(name string, f ConsumerFunc)
	Run()
	ShutDown()
}

type ConsumerFunc

type ConsumerFunc func(message Message) error

type Memory

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

Memory struct

func (*Memory) Append

func (m *Memory) Append(name string, message Message) error

func (*Memory) Connect

func (m *Memory) Connect() 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, duration time.Duration) error

func (*Memory) Get

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

func (*Memory) HashDel

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

func (*Memory) HashGet

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

func (*Memory) Increase

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

func (*Memory) Register

func (m *Memory) Register(name string, f ConsumerFunc)

func (*Memory) Run

func (m *Memory) Run()

func (*Memory) Set

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

func (*Memory) ShutDown

func (m *Memory) ShutDown()

type MemoryMessage

type MemoryMessage struct {
	redisqueue.Message
}

func (*MemoryMessage) GetID

func (m *MemoryMessage) GetID() string

func (*MemoryMessage) GetStream

func (m *MemoryMessage) GetStream() string

func (*MemoryMessage) GetValues

func (m *MemoryMessage) GetValues() map[string]interface{}

func (*MemoryMessage) SetID

func (m *MemoryMessage) SetID(id string)

func (*MemoryMessage) SetStream

func (m *MemoryMessage) SetStream(stream string)

func (*MemoryMessage) SetValues

func (m *MemoryMessage) SetValues(value map[string]interface{})

type Message

type Message interface {
	SetID(string)
	SetStream(string)
	SetValues(map[string]interface{})
	GetID() string
	GetStream() string
	GetValues() map[string]interface{}
}

type Redis

type Redis struct {
	ConnectOption   *redis.Options
	ConsumerOptions *redisqueue.ConsumerOptions
	ProducerOptions *redisqueue.ProducerOptions
	// contains filtered or unexported fields
}

func (*Redis) Append

func (r *Redis) Append(name string, message Message) error

func (*Redis) Connect

func (r *Redis) Connect() error

func (*Redis) Decrease

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

func (*Redis) Del

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

func (*Redis) Expire

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

func (*Redis) Get

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

func (*Redis) GetClient

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

func (*Redis) HashDel

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

func (*Redis) HashGet

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

func (*Redis) HashMSet

func (r *Redis) HashMSet(hashKey string, value ...interface{}) error

func (*Redis) HashSet

func (r *Redis) HashSet(hashKey string, value ...interface{}) error

func (*Redis) HashSetNX

func (r *Redis) HashSetNX(hashKey, field string, value interface{}) error

func (*Redis) Increase

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

func (*Redis) Lock

func (r *Redis) Lock(key string, ttl int64, option *redislock.Options) (*redislock.Lock, error)

func (*Redis) Register

func (r *Redis) Register(name string, f ConsumerFunc)

func (*Redis) Run

func (r *Redis) Run()

func (*Redis) Set

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

func (*Redis) ShutDown

func (r *Redis) ShutDown()

type RedisMessage

type RedisMessage struct {
	redisqueue.Message
}

func (*RedisMessage) GetID

func (m *RedisMessage) GetID() string

func (*RedisMessage) GetStream

func (m *RedisMessage) GetStream() string

func (*RedisMessage) GetValues

func (m *RedisMessage) GetValues() map[string]interface{}

func (*RedisMessage) SetID

func (m *RedisMessage) SetID(id string)

func (*RedisMessage) SetStream

func (m *RedisMessage) SetStream(stream string)

func (*RedisMessage) SetValues

func (m *RedisMessage) SetValues(value map[string]interface{})

Jump to

Keyboard shortcuts

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