Documentation
¶
Overview ¶
Code generated by go generate; DO NOT EDIT.
Index ¶
- Constants
- func CallCached[T any](c Cache, ttl time.Duration, fnname string, fn any, args ...any) (T, error)
- func DecodeKey(key string, keyHash KeyHashType) (string, error)
- func StatStr(stat Stat) string
- func WrapContext1[A1 any, R any](ctx context.Context, f func(context.Context, A1) (R, error)) func(A1) (R, error)
- func WrapContext2[A1 any, A2 any, R any](ctx context.Context, f func(context.Context, A1, A2) (R, error)) func(A1, A2) (R, error)
- func WrapContext3[A1 any, A2 any, A3 any, R any](ctx context.Context, f func(context.Context, A1, A2, A3) (R, error)) func(A1, A2, A3) (R, error)
- func WrapContext4[A1 any, A2 any, A3 any, A4 any, R any](ctx context.Context, f func(context.Context, A1, A2, A3, A4) (R, error)) func(A1, A2, A3, A4) (R, error)
- func WrapContext5[A1 any, A2 any, A3 any, A4 any, A5 any, R any](ctx context.Context, f func(context.Context, A1, A2, A3, A4, A5) (R, error)) func(A1, A2, A3, A4, A5) (R, error)
- func WrapContext6[A1 any, A2 any, A3 any, A4 any, A5 any, A6 any, R any](ctx context.Context, ...) func(A1, A2, A3, A4, A5, A6) (R, error)
- func WrapContext7[A1 any, A2 any, A3 any, A4 any, A5 any, A6 any, A7 any, R any](ctx context.Context, ...) func(A1, A2, A3, A4, A5, A6, A7) (R, error)
- func WrapContext8[A1 any, A2 any, A3 any, A4 any, A5 any, A6 any, A7 any, A8 any, R any](ctx context.Context, ...) func(A1, A2, A3, A4, A5, A6, A7, A8) (R, error)
- func WrapContext9[A1 any, A2 any, A3 any, A4 any, A5 any, A6 any, A7 any, A8 any, A9 any, R any](ctx context.Context, ...) func(A1, A2, A3, A4, A5, A6, A7, A8, A9) (R, error)
- func WrapContext10[A1 any, A2 any, A3 any, A4 any, A5 any, A6 any, A7 any, A8 any, A9 any, ...](ctx context.Context, ...) func(A1, A2, A3, A4, A5, A6, A7, A8, A9, A10) (R, error)
- type Cache
- type CacheBase
- func (cb *CacheBase) CacheKey(fnname string, fn any, args ...any) (string, error)
- func (cb *CacheBase) EncodeKey(key string) string
- func (cb *CacheBase) GetSingleflightWrapper() SingleflightWrapper
- func (cb *CacheBase) GetStat() Stat
- func (cb *CacheBase) IncHit()
- func (cb *CacheBase) IncMiss()
- func (cb *CacheBase) IncShared()
- func (cb *CacheBase) LaunchRefresh(fn func())
- type CacheConfig
- type InMemoryCache
- func (imc *InMemoryCache) Get(key string) (string, bool, error)
- func (imc *InMemoryCache) GetAllKeys() ([]string, error)
- func (imc *InMemoryCache) GetKeyHashType() KeyHashType
- func (imc *InMemoryCache) Invalidate(key string) error
- func (imc *InMemoryCache) InvalidateByMatch(keyMatcher func(decodedKey string) bool) error
- func (imc *InMemoryCache) Set(key string, value string, ttl time.Duration) error
- type InMemoryCacheConfig
- type KeyHashType
- type SingleflightWrapper
- type Stat
- type ValkeyCache
- func (vc *ValkeyCache) Get(key string) (string, bool, error)
- func (vc *ValkeyCache) GetAllKeys() ([]string, error)
- func (vc *ValkeyCache) GetKeyHashType() KeyHashType
- func (vc *ValkeyCache) Invalidate(key string) error
- func (vc *ValkeyCache) InvalidateByMatch(keyMatcher func(decodedKey string) bool) error
- func (vc *ValkeyCache) Set(key string, value string, ttl time.Duration) error
- type ValkeyCacheConfig
Constants ¶
View Source
const DefaultKeyHash = KEY_HASH_BASE64
Variables ¶
This section is empty.
Functions ¶
func CallCached ¶
func WrapContext1 ¶ added in v1.60.1
func WrapContext2 ¶ added in v1.60.1
func WrapContext3 ¶ added in v1.60.1
func WrapContext4 ¶ added in v1.60.1
func WrapContext5 ¶ added in v1.60.1
func WrapContext6 ¶ added in v1.60.1
func WrapContext7 ¶ added in v1.60.1
func WrapContext8 ¶ added in v1.60.1
func WrapContext9 ¶ added in v1.60.1
func WrapContext10 ¶ added in v1.60.1
Types ¶
type Cache ¶
type Cache interface {
CacheKey(fnname string, fn any, args ...any) (string, error)
Get(key string) (string, bool, error)
GetAllKeys() ([]string, error)
Set(key string, value string, ttl time.Duration) error
Invalidate(key string) error
InvalidateByMatch(keyMatcher func(decodedKey string) bool) error
IncHit()
IncMiss()
GetStat() Stat
LaunchRefresh(fn func())
GetSingleflightWrapper() SingleflightWrapper
GetKeyHashType() KeyHashType
}
type CacheBase ¶
type CacheBase struct {
// contains filtered or unexported fields
}
func NewCacheBase ¶
func (*CacheBase) GetSingleflightWrapper ¶ added in v1.55.0
func (cb *CacheBase) GetSingleflightWrapper() SingleflightWrapper
func (*CacheBase) LaunchRefresh ¶
func (cb *CacheBase) LaunchRefresh(fn func())
type CacheConfig ¶
type InMemoryCache ¶
type InMemoryCache struct {
*CacheBase
// contains filtered or unexported fields
}
func NewInMemoryCache ¶
func NewInMemoryCache( ctx context.Context, wg *sync.WaitGroup, config InMemoryCacheConfig, ) *InMemoryCache
func (*InMemoryCache) GetAllKeys ¶ added in v1.60.1
func (imc *InMemoryCache) GetAllKeys() ([]string, error)
func (*InMemoryCache) GetKeyHashType ¶ added in v1.60.1
func (imc *InMemoryCache) GetKeyHashType() KeyHashType
func (*InMemoryCache) Invalidate ¶
func (imc *InMemoryCache) Invalidate(key string) error
func (*InMemoryCache) InvalidateByMatch ¶ added in v1.60.1
func (imc *InMemoryCache) InvalidateByMatch(keyMatcher func(decodedKey string) bool) error
type InMemoryCacheConfig ¶
type InMemoryCacheConfig struct {
CacheConfig
CleanupInterval time.Duration
}
type KeyHashType ¶
type KeyHashType int
const ( KEY_HASH_BASE64 KeyHashType = iota KEY_HASH_SHA256 KEY_HASH_SHA512 KEY_HASH_HEX KEY_HASH_NONE )
func ParseKeyHashType ¶
func ParseKeyHashType(s string) KeyHashType
func (KeyHashType) String ¶
func (k KeyHashType) String() string
type SingleflightWrapper ¶ added in v1.55.0
type ValkeyCache ¶
type ValkeyCache struct {
*CacheBase
// contains filtered or unexported fields
}
func NewValkeyCache ¶
func NewValkeyCache( ctx context.Context, wg *sync.WaitGroup, config ValkeyCacheConfig, ) *ValkeyCache
func (*ValkeyCache) GetAllKeys ¶ added in v1.60.1
func (vc *ValkeyCache) GetAllKeys() ([]string, error)
func (*ValkeyCache) GetKeyHashType ¶ added in v1.60.1
func (vc *ValkeyCache) GetKeyHashType() KeyHashType
func (*ValkeyCache) Invalidate ¶
func (vc *ValkeyCache) Invalidate(key string) error
func (*ValkeyCache) InvalidateByMatch ¶ added in v1.60.1
func (vc *ValkeyCache) InvalidateByMatch(keyMatcher func(decodedKey string) bool) error
type ValkeyCacheConfig ¶
Click to show internal directories.
Click to hide internal directories.