cache

package
v1.1.16 Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2023 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 Gredis

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

Gredis cache implement

func NewGredis

func NewGredis(client *gredis.Redis) (*Gredis, error)

NewGredis redis模式

func (*Gredis) Decrease

func (r *Gredis) Decrease(ctx context.Context, key string) error

func (*Gredis) Del

func (r *Gredis) Del(ctx context.Context, key string) error

Del delete key in redis

func (*Gredis) Expire

func (r *Gredis) Expire(ctx context.Context, key string, dur time.Duration) error

Expire Set ttl

func (*Gredis) Get

func (r *Gredis) Get(ctx context.Context, key string) (*gvar.Var, error)

Get from key

func (*Gredis) GetClient

func (r *Gredis) GetClient() *gredis.Redis

GetClient 暴露原生client

func (*Gredis) HashDel

func (r *Gredis) HashDel(ctx context.Context, hk, key string) error

HashDel delete key in specify redis's hashtable

func (*Gredis) HashGet

func (r *Gredis) HashGet(ctx context.Context, hk, key string) (*gvar.Var, error)

HashGet from key

func (*Gredis) Increase

func (r *Gredis) Increase(ctx context.Context, key string) error

Increase get Increase

func (*Gredis) Set

func (r *Gredis) Set(ctx context.Context, key string, val interface{}, expire int) error

Set value with key and expire time

func (*Gredis) String

func (*Gredis) String() string

type Memory

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

func NewMemory

func NewMemory() *Memory

NewMemory memory模式

func (*Memory) Decrease

func (m *Memory) Decrease(ctx context.Context, key string) error

func (*Memory) Del

func (m *Memory) Del(ctx context.Context, key string) error

func (*Memory) Expire

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

func (*Memory) Get

func (m *Memory) Get(ctx context.Context, key string) (*gvar.Var, error)

func (*Memory) HashDel

func (m *Memory) HashDel(ctx context.Context, hk, key string) error

func (*Memory) HashGet

func (m *Memory) HashGet(ctx context.Context, hk, key string) (*gvar.Var, error)

func (*Memory) Increase

func (m *Memory) Increase(ctx context.Context, key string) error

func (*Memory) Set

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

func (*Memory) String

func (*Memory) String() string

type Message

type Message struct {
	redisqueue.Message
}

func (*Message) GetID

func (m *Message) GetID() string

func (*Message) GetPrefix

func (m *Message) GetPrefix() (prefix string)

func (*Message) GetStream

func (m *Message) GetStream() string

func (*Message) GetValues

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

func (*Message) SetID

func (m *Message) SetID(id string)

func (*Message) SetPrefix

func (m *Message) SetPrefix(prefix string)

func (*Message) SetStream

func (m *Message) SetStream(stream string)

func (*Message) SetValues

func (m *Message) SetValues(values map[string]interface{})

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) 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

Expire 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) 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) Increase

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

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