bloom

package
v0.0.0-...-1b0a6d5 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CacheData

func CacheData[T any](cb *CacheBloom, ctx context.Context, key string, data T, ttl time.Duration) (T, error)

CacheData 序列化数据并存储到 Redis 和布隆过滤器中

func QueryData

func QueryData[T any](cb *CacheBloom, ctx context.Context, key string, data T, ttl time.Duration) (T, error)

QueryData 查询数据,如果缓存和布隆过滤器都没有命中,则存储并返回传递的数据

Types

type CacheBloom

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

func NewCacheBloom

func NewCacheBloom(client redis.Cmdable) *CacheBloom

func (*CacheBloom) SetEmptyCache

func (cb *CacheBloom) SetEmptyCache(ctx context.Context, key string, ttl time.Duration) error

SetEmptyCache 缓存空对象,防止缓存穿透

Jump to

Keyboard shortcuts

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