Documentation
¶
Index ¶
- Constants
- func CallCached[T any](c Cache, ttl time.Duration, fnname string, fn interface{}, args ...interface{}) (T, error)
- func DecodeKey(key string, keyHash KeyHashType) (string, error)
- func StatStr(stat Stat) string
- type Cache
- type CacheBase
- type CacheConfig
- type InMemoryCache
- type InMemoryCacheConfig
- type KeyHashType
- type NoCache
- func (nc NoCache) CacheKey(fnname string, fn interface{}, args ...interface{}) (string, error)
- func (nc NoCache) Get(key string) (string, bool, error)
- func (nc NoCache) GetStat() Stat
- func (nc NoCache) IncHit()
- func (nc NoCache) IncMiss()
- func (nc NoCache) Invalidate(key string) error
- func (nc NoCache) LaunchRefresh(func())
- func (nc NoCache) Set(key string, value string, ttl time.Duration) error
- type Stat
- type ValkeyCache
- type ValkeyCacheConfig
Constants ¶
View Source
const DefaultKeyHash = KEY_HASH_BASE64
Variables ¶
This section is empty.
Functions ¶
func CallCached ¶
Types ¶
type Cache ¶
type CacheBase ¶
type CacheBase struct {
// contains filtered or unexported fields
}
func NewCacheBase ¶
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) Invalidate ¶
func (imc InMemoryCache) Invalidate(key string) 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 NoCache ¶
type NoCache struct {
}
func NewNoCache ¶
func NewNoCache() *NoCache
func (NoCache) Invalidate ¶
func (NoCache) LaunchRefresh ¶
func (nc NoCache) LaunchRefresh(func())
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) Invalidate ¶
func (vc *ValkeyCache) Invalidate(key string) error
type ValkeyCacheConfig ¶
type ValkeyCacheConfig struct {
CacheConfig
Url string
Password string
Db int
}
Click to show internal directories.
Click to hide internal directories.