bucket

package
v2.0.51 Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2023 License: Apache-2.0 Imports: 5 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[T any] struct {
	Mu  sync.Locker
	Idx string
	M   map[string]T
}

Memory 通用安全桶

func (*Memory[T]) All added in v2.0.47

func (b *Memory[T]) All(ctx context.Context) (map[string]T, error)

func (*Memory[T]) Del

func (b *Memory[T]) Del(ctx context.Context, key string) (int64, error)

func (*Memory[T]) Get

func (b *Memory[T]) Get(ctx context.Context, key string) (T, error)

func (*Memory[T]) Has

func (b *Memory[T]) Has(ctx context.Context, key string) (bool, error)

func (*Memory[T]) Index

func (b *Memory[T]) Index() string

func (*Memory[T]) Len

func (b *Memory[T]) Len(ctx context.Context) (int64, error)

func (*Memory[T]) Set

func (b *Memory[T]) Set(ctx context.Context, key string, item T) (int64, error)

type Redis

type Redis struct {
	Mu    *redsync.Mutex
	Table string
	Store *redis.Client
}

func NewRedis

func NewRedis(table string, mutex *redsync.Mutex, client *redis.Client) *Redis

func (*Redis) All added in v2.0.47

func (b *Redis) All(ctx context.Context) (map[string]string, error)

func (*Redis) Del

func (b *Redis) Del(ctx context.Context, field string) (int64, error)

func (*Redis) Get

func (b *Redis) Get(ctx context.Context, field string) (string, error)

func (*Redis) Has

func (b *Redis) Has(ctx context.Context, field string) (bool, error)

func (*Redis) Index

func (b *Redis) Index() string

func (*Redis) Len

func (b *Redis) Len(ctx context.Context) (int64, error)

func (*Redis) Lock

func (b *Redis) Lock(ctx context.Context) error

func (*Redis) Set

func (b *Redis) Set(ctx context.Context, field string, value string) (int64, error)

func (*Redis) Unlock

func (b *Redis) Unlock(ctx context.Context)

Jump to

Keyboard shortcuts

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