cache2

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewLevel2Cache

func NewLevel2Cache(appCtx fiberhouse.IContext, local cache.Cache, remote cache.Cache) cache.Cache

Types

type Level2Cache

type Level2Cache struct {
	Ctx fiberhouse.IContext
	// contains filtered or unexported fields
}

Level2Cache 二级缓存实现(本地+远程)

func (*Level2Cache) Close

func (l2c *Level2Cache) Close() error

Close 关闭缓存实例,释放资源(应用退出时调用Close关闭资源)

func (*Level2Cache) Delete

func (l2c *Level2Cache) Delete(ctx context.Context, keys ...string) error

Delete 删除缓存值

func (*Level2Cache) Get

func (l2c *Level2Cache) Get(ctx context.Context, key string, co *cache.CacheOption) (string, error)

Get 获取缓存值

func (*Level2Cache) GetLevel

func (l2c *Level2Cache) GetLevel() cache.Level

GetLevel 获取缓存级别

func (*Level2Cache) GetLocal

func (l2c *Level2Cache) GetLocal() cache.Cache

GetLocal 获取本地缓存实例

func (*Level2Cache) GetLocalMetrics

func (l2c *Level2Cache) GetLocalMetrics(co *cache.CacheOption) *ristretto.Metrics

GetLocalMetrics 获取本地缓存指标

func (*Level2Cache) GetLocalMetricsInfo

func (l2c *Level2Cache) GetLocalMetricsInfo(co *cache.CacheOption) *cachelocal.CacheMetricsInfo

GetLocalMetricsInfo 获取本地缓存指标

func (*Level2Cache) GetPoolMetrics

func (l2c *Level2Cache) GetPoolMetrics() map[string]interface{}

GetPoolMetrics 获取goroutine池指标

func (*Level2Cache) GetRemote

func (l2c *Level2Cache) GetRemote() cache.Cache

GetRemote 获取远程缓存实例

func (*Level2Cache) Set

func (l2c *Level2Cache) Set(ctx context.Context, key string, value interface{}, co *cache.CacheOption) error

Set 设置缓存值

func (*Level2Cache) Wait

func (l2c *Level2Cache) Wait() error

Wait 当写入后立即读取时,等待底层缓存完成写入操作

Jump to

Keyboard shortcuts

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