priority

package
v0.0.0-...-7567983 Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithCacheLimit

func WithCacheLimit(cacheLimit int) option.Option[RBTreePriorityCache]

WithCacheLimit 设置所允许的最大键值对数量

func WithDefaultPriority

func WithDefaultPriority(priority int) option.Option[RBTreePriorityCache]

Types

type Priority

type Priority interface {
	// Priority 获取元素的优先级
	Priority() int
}

Priority 如果传进来的元素没有实现该接口,则默认优先级为0

type RBTreePriorityCache

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

func NewRBTreePriorityCache

func NewRBTreePriorityCache(opts ...option.Option[RBTreePriorityCache]) (*RBTreePriorityCache, error)

func (*RBTreePriorityCache) DecrBy

func (r *RBTreePriorityCache) DecrBy(ctx context.Context, key string, value int64) (int64, error)

func (*RBTreePriorityCache) Delete

func (r *RBTreePriorityCache) Delete(ctx context.Context, keys ...string) (int64, error)

func (*RBTreePriorityCache) Get

func (r *RBTreePriorityCache) Get(ctx context.Context, key string) (val ecache.Value)

func (*RBTreePriorityCache) GetSet

func (r *RBTreePriorityCache) GetSet(ctx context.Context, key string, val string) ecache.Value

func (*RBTreePriorityCache) IncrBy

func (r *RBTreePriorityCache) IncrBy(ctx context.Context, key string, value int64) (int64, error)

func (*RBTreePriorityCache) IncrByFloat

func (r *RBTreePriorityCache) IncrByFloat(ctx context.Context, key string, value float64) (float64, error)

func (*RBTreePriorityCache) LPop

func (*RBTreePriorityCache) LPush

func (r *RBTreePriorityCache) LPush(ctx context.Context, key string, val ...any) (int64, error)

func (*RBTreePriorityCache) SAdd

func (r *RBTreePriorityCache) SAdd(ctx context.Context, key string, members ...any) (int64, error)

func (*RBTreePriorityCache) SRem

func (r *RBTreePriorityCache) SRem(_ context.Context, key string, members ...any) (int64, error)

func (*RBTreePriorityCache) Set

func (r *RBTreePriorityCache) Set(_ context.Context, key string, val any, expiration time.Duration) error

func (*RBTreePriorityCache) SetNX

func (r *RBTreePriorityCache) SetNX(ctx context.Context, key string, val any, expiration time.Duration) (bool, error)

Jump to

Keyboard shortcuts

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