cachekey

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2025 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Global = New()

全局缓存键优化器实例(仅供内部模块复用)

Functions

func FastKey

func FastKey(data string) string

FastKey 全局快速键生成函数

func Key

func Key(prefix, data string) string

Key 全局键生成函数

func KeyWithContext

func KeyWithContext(desensitizer, dataType, data string) string

KeyWithContext 全局上下文键生成函数

Types

type CacheKey

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

CacheKey 缓存键优化器

func New

func New() *CacheKey

New 创建缓存键优化器

func (*CacheKey) ClearPrefixCache

func (cko *CacheKey) ClearPrefixCache()

ClearPrefixCache 清除前缀缓存

func (*CacheKey) FastStringHash

func (cko *CacheKey) FastStringHash(s string) uint64

FastStringHash 快速字符串哈希(内联优化版本)

func (*CacheKey) GenerateFastKey

func (cko *CacheKey) GenerateFastKey(data string) string

GenerateFastKey 生成快速键(平衡性能和碰撞率)

func (*CacheKey) GenerateHashKey

func (cko *CacheKey) GenerateHashKey(data string) string

GenerateHashKey 生成纯哈希键

func (*CacheKey) GenerateKey

func (cko *CacheKey) GenerateKey(prefix, data string) string

GenerateKey 生成优化的缓存键 使用 xxhash 算法生成高性能、低碰撞的缓存键

func (*CacheKey) GenerateKeyWithContext

func (cko *CacheKey) GenerateKeyWithContext(desensitizer, dataType, data string) string

GenerateKeyWithContext 生成带上下文的缓存键

func (*CacheKey) GenerateLayeredKey

func (cko *CacheKey) GenerateLayeredKey(layers ...string) string

GenerateLayeredKey 生成分层键

func (*CacheKey) GetCacheStats

func (cko *CacheKey) GetCacheStats() map[string]interface{}

GetCacheStats 获取缓存优化器统计信息

func (*CacheKey) HashCombine

func (cko *CacheKey) HashCombine(hashes ...uint64) uint64

HashCombine 组合多个哈希值

func (*CacheKey) IsXXHashEnabled

func (cko *CacheKey) IsXXHashEnabled() bool

IsXXHashEnabled 是否启用 xxhash

func (*CacheKey) SetXXHashEnabled

func (cko *CacheKey) SetXXHashEnabled(enabled bool)

SetXXHashEnabled 设置是否启用 xxhash

Jump to

Keyboard shortcuts

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