cache

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2024 License: BSD-2-Clause Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrKeyNotFound = errors.New("key not found")
View Source
var ErrTypeMismatch = errors.New("type mismatch")

Functions

This section is empty.

Types

type Etcd added in v0.4.4

type Etcd struct {
	Name   string
	Config EtcdConfig
	// contains filtered or unexported fields
}

func NewEtcd added in v0.4.4

func NewEtcd(name string, cfg EtcdConfig) *Etcd

func (*Etcd) Decrement added in v0.4.4

func (t *Etcd) Decrement(ctx context.Context, key string, val int64, timeout time.Duration) (int64, error)

func (*Etcd) DecrementIn added in v0.4.4

func (t *Etcd) DecrementIn(ctx context.Context, key string, key2 string, val int64, timeout time.Duration) (int64, error)

func (*Etcd) Delete added in v0.4.4

func (t *Etcd) Delete(ctx context.Context, key string) error

func (*Etcd) Expire added in v0.4.4

func (t *Etcd) Expire(ctx context.Context, key string, timeout time.Duration) error

func (*Etcd) Get added in v0.4.4

func (t *Etcd) Get(ctx context.Context, key string) (any, error)

func (*Etcd) GetIn added in v0.4.4

func (t *Etcd) GetIn(ctx context.Context, key string, key2 string) (any, error)

func (*Etcd) GetMap added in v0.4.4

func (t *Etcd) GetMap(ctx context.Context, key string) (any, error)

func (*Etcd) Has added in v0.4.4

func (t *Etcd) Has(ctx context.Context, key string) bool

func (*Etcd) Increment added in v0.4.4

func (t *Etcd) Increment(ctx context.Context, key string, val int64, timeout time.Duration) (int64, error)

func (*Etcd) IncrementIn added in v0.4.4

func (t *Etcd) IncrementIn(ctx context.Context, key string, key2 string, val int64, timeout time.Duration) (int64, error)

func (*Etcd) Init added in v0.4.4

func (t *Etcd) Init(app interfaces.IEngine) error

func (*Etcd) Set added in v0.4.4

func (t *Etcd) Set(ctx context.Context, key string, args any, timeout time.Duration) error

func (*Etcd) SetIn added in v0.4.4

func (t *Etcd) SetIn(ctx context.Context, key string, key2 string, args any, timeout time.Duration) error

func (*Etcd) SetMap added in v0.4.4

func (t *Etcd) SetMap(ctx context.Context, key string, args any, timeout time.Duration) error

func (*Etcd) Stop added in v0.4.4

func (t *Etcd) Stop() error

func (*Etcd) String added in v0.4.4

func (t *Etcd) String() string

type EtcdConfig added in v0.4.4

type EtcdConfig struct {
	Hosts    string `yaml:"hosts"`
	Username string `yaml:"username,omitempty"`
	Password string `yaml:"password,omitempty"`
}

type Memcached added in v0.0.9

type Memcached struct {
	Name   string
	Config MemcachedConfig
	// contains filtered or unexported fields
}

func NewMemcached added in v0.0.9

func NewMemcached(name string, cfg MemcachedConfig) *Memcached

func (*Memcached) Decrement added in v0.0.9

func (t *Memcached) Decrement(ctx context.Context, key string, val int64, timeout time.Duration) (int64, error)

func (*Memcached) DecrementIn added in v0.0.9

func (t *Memcached) DecrementIn(ctx context.Context, key string, key2 string, val int64, timeout time.Duration) (int64, error)

func (*Memcached) Delete added in v0.0.9

func (t *Memcached) Delete(ctx context.Context, key string) error

func (*Memcached) Expire added in v0.2.0

func (t *Memcached) Expire(ctx context.Context, key string, timeout time.Duration) error

func (*Memcached) Get added in v0.0.9

func (t *Memcached) Get(ctx context.Context, key string) (any, error)

func (*Memcached) GetIn added in v0.0.9

func (t *Memcached) GetIn(ctx context.Context, key string, key2 string) (any, error)

func (*Memcached) GetMap added in v0.0.9

func (t *Memcached) GetMap(ctx context.Context, key string) (any, error)

func (*Memcached) Has added in v0.0.9

func (t *Memcached) Has(ctx context.Context, key string) bool

func (*Memcached) Increment added in v0.0.9

func (t *Memcached) Increment(ctx context.Context, key string, val int64, timeout time.Duration) (int64, error)

func (*Memcached) IncrementIn added in v0.0.9

func (t *Memcached) IncrementIn(ctx context.Context, key string, key2 string, val int64, timeout time.Duration) (int64, error)

func (*Memcached) Init added in v0.0.9

func (t *Memcached) Init(app interfaces.IEngine) error

func (*Memcached) Set added in v0.0.9

func (t *Memcached) Set(ctx context.Context, key string, args any, timeout time.Duration) error

func (*Memcached) SetIn added in v0.0.9

func (t *Memcached) SetIn(ctx context.Context, key string, key2 string, args any, timeout time.Duration) error

func (*Memcached) SetMap added in v0.0.9

func (t *Memcached) SetMap(ctx context.Context, key string, args any, timeout time.Duration) error

func (*Memcached) Stop added in v0.0.9

func (t *Memcached) Stop() error

func (*Memcached) String added in v0.0.9

func (t *Memcached) String() string

type MemcachedConfig added in v0.0.9

type MemcachedConfig struct {
	Hosts   string        `yaml:"hosts"`
	Timeout time.Duration `yaml:"timeout"`
}

type Memory

type Memory struct {
	Name   string
	Config MemoryConfig
	// contains filtered or unexported fields
}

func NewMemory added in v0.0.9

func NewMemory(name string, cfg MemoryConfig) *Memory

func (*Memory) Decrement added in v0.0.9

func (t *Memory) Decrement(ctx context.Context, key string, val int64, timeout time.Duration) (int64, error)

func (*Memory) DecrementIn added in v0.0.9

func (t *Memory) DecrementIn(ctx context.Context, key string, key2 string, val int64, timeout time.Duration) (int64, error)

func (*Memory) Delete

func (t *Memory) Delete(ctx context.Context, key string) error

func (*Memory) Expire added in v0.2.0

func (t *Memory) Expire(ctx context.Context, key string, timeout time.Duration) error

func (*Memory) Get

func (t *Memory) Get(ctx context.Context, key string) (any, error)

func (*Memory) GetIn added in v0.0.9

func (t *Memory) GetIn(ctx context.Context, key string, key2 string) (any, error)

func (*Memory) GetMap added in v0.0.9

func (t *Memory) GetMap(ctx context.Context, key string) (any, error)

func (*Memory) Has

func (t *Memory) Has(ctx context.Context, key string) bool

func (*Memory) Increment added in v0.0.9

func (t *Memory) Increment(ctx context.Context, key string, val int64, timeout time.Duration) (int64, error)

func (*Memory) IncrementIn added in v0.0.9

func (t *Memory) IncrementIn(ctx context.Context, key string, key2 string, val int64, timeout time.Duration) (int64, error)

func (*Memory) Init

func (t *Memory) Init(app interfaces.IEngine) error

func (*Memory) Set

func (t *Memory) Set(ctx context.Context, key string, args any, timeout time.Duration) error

func (*Memory) SetIn added in v0.0.9

func (t *Memory) SetIn(ctx context.Context, key string, key2 string, args any, timeout time.Duration) error

func (*Memory) SetMap added in v0.0.9

func (t *Memory) SetMap(ctx context.Context, key string, args any, timeout time.Duration) error

func (*Memory) Stop

func (t *Memory) Stop() error

func (*Memory) String

func (t *Memory) String() string

type MemoryConfig added in v0.0.9

type MemoryConfig struct {
	TimeClear time.Duration `yaml:"time_clear"`
}

type Mock

type Mock struct {
	Name string
}

func (*Mock) Decrement added in v0.3.0

func (t *Mock) Decrement(ctx context.Context, key string, val int64, timeout time.Duration) (int64, error)

func (*Mock) DecrementIn added in v0.3.0

func (t *Mock) DecrementIn(ctx context.Context, key string, key2 string, val int64, timeout time.Duration) (int64, error)

func (*Mock) Delete

func (t *Mock) Delete(ctx context.Context, key string) error

func (*Mock) Expire added in v0.3.0

func (t *Mock) Expire(ctx context.Context, key string, timeout time.Duration) error

func (*Mock) Get

func (t *Mock) Get(ctx context.Context, key string) (any, error)

func (*Mock) GetIn added in v0.3.0

func (t *Mock) GetIn(ctx context.Context, key string, key2 string) (any, error)

func (*Mock) GetMap added in v0.3.0

func (t *Mock) GetMap(ctx context.Context, key string) (any, error)

func (*Mock) Has

func (t *Mock) Has(ctx context.Context, key string) bool

func (*Mock) Increment added in v0.3.0

func (t *Mock) Increment(ctx context.Context, key string, val int64, timeout time.Duration) (int64, error)

func (*Mock) IncrementIn added in v0.3.0

func (t *Mock) IncrementIn(ctx context.Context, key string, key2 string, val int64, timeout time.Duration) (int64, error)

func (*Mock) Init

func (t *Mock) Init(_ interfaces.IEngine) error

func (*Mock) Set

func (t *Mock) Set(ctx context.Context, key string, args any, timeout time.Duration) error

func (*Mock) SetIn added in v0.3.0

func (t *Mock) SetIn(ctx context.Context, key string, key2 string, args any, timeout time.Duration) error

func (*Mock) SetMap added in v0.3.0

func (t *Mock) SetMap(ctx context.Context, key string, args any, timeout time.Duration) error

func (*Mock) Stop

func (t *Mock) Stop() error

func (*Mock) String

func (t *Mock) String() string

type Redis added in v0.0.9

type Redis struct {
	Name   string
	Config RedisConfig
	// contains filtered or unexported fields
}

func NewRedis added in v0.0.9

func NewRedis(name string, cfg RedisConfig) *Redis

func (*Redis) Decrement added in v0.0.9

func (t *Redis) Decrement(ctx context.Context, key string, val int64, timeout time.Duration) (int64, error)

func (*Redis) DecrementIn added in v0.0.9

func (t *Redis) DecrementIn(ctx context.Context, key string, key2 string, val int64, timeout time.Duration) (int64, error)

func (*Redis) Delete added in v0.0.9

func (t *Redis) Delete(ctx context.Context, key string) error

func (*Redis) Expire added in v0.2.0

func (t *Redis) Expire(ctx context.Context, key string, timeout time.Duration) error

func (*Redis) Get added in v0.0.9

func (t *Redis) Get(ctx context.Context, key string) (any, error)

func (*Redis) GetIn added in v0.0.9

func (t *Redis) GetIn(ctx context.Context, key string, key2 string) (any, error)

func (*Redis) GetMap added in v0.0.9

func (t *Redis) GetMap(ctx context.Context, key string) (any, error)

func (*Redis) Has added in v0.0.9

func (t *Redis) Has(ctx context.Context, key string) bool

func (*Redis) Increment added in v0.0.9

func (t *Redis) Increment(ctx context.Context, key string, val int64, timeout time.Duration) (int64, error)

func (*Redis) IncrementIn added in v0.0.9

func (t *Redis) IncrementIn(ctx context.Context, key string, key2 string, val int64, timeout time.Duration) (int64, error)

func (*Redis) Init added in v0.0.9

func (t *Redis) Init(app interfaces.IEngine) error

func (*Redis) Set added in v0.0.9

func (t *Redis) Set(ctx context.Context, key string, args any, timeout time.Duration) error

func (*Redis) SetIn added in v0.0.9

func (t *Redis) SetIn(ctx context.Context, key string, key2 string, args any, timeout time.Duration) error

func (*Redis) SetMap added in v0.0.9

func (t *Redis) SetMap(ctx context.Context, key string, args any, timeout time.Duration) error

func (*Redis) Stop added in v0.0.9

func (t *Redis) Stop() error

func (*Redis) String added in v0.0.9

func (t *Redis) String() string

type RedisConfig added in v0.0.9

type RedisConfig struct {
	Hosts      string        `yaml:"hosts"`
	UseCluster bool          `yaml:"use_cluster,omitempty"`
	DBNum      int           `yaml:"db_num,omitempty"`
	Timeout    time.Duration `yaml:"timeout"`
	Username   string        `yaml:"username,omitempty"`
	Password   string        `yaml:"password,omitempty"`
}

type TimeHeap

type TimeHeap []*TimeHeapItem

func (*TimeHeap) Len

func (t *TimeHeap) Len() int

func (*TimeHeap) Less

func (t *TimeHeap) Less(i, j int) bool

func (*TimeHeap) Pop

func (t *TimeHeap) Pop() any

func (*TimeHeap) Push

func (t *TimeHeap) Push(x any)

func (*TimeHeap) Swap

func (t *TimeHeap) Swap(i, j int)

func (*TimeHeap) Top

func (t *TimeHeap) Top() any

type TimeHeapItem

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

Jump to

Keyboard shortcuts

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