Documentation
¶
Index ¶
- Variables
- type PageTypeStats
- type RedisCache
- func (cache *RedisCache) DeleteByPrefix(ctx context.Context, prefix string) error
- func (cache *RedisCache) Get(ctx context.Context, key string, returnValue interface{}) (interface{}, error)
- func (cache *RedisCache) GetBool(ctx context.Context, key string) (bool, error)
- func (cache *RedisCache) GetBytes(ctx context.Context, key string) ([]byte, error)
- func (cache *RedisCache) GetString(ctx context.Context, key string) (string, error)
- func (cache *RedisCache) GetUint64(ctx context.Context, key string) (uint64, error)
- func (cache *RedisCache) Set(ctx context.Context, key string, value interface{}, expiration time.Duration) error
- func (cache *RedisCache) SetBool(ctx context.Context, key string, value bool, expiration time.Duration) error
- func (cache *RedisCache) SetBytes(ctx context.Context, key string, value []byte, expiration time.Duration) error
- func (cache *RedisCache) SetString(ctx context.Context, key, value string, expiration time.Duration) error
- func (cache *RedisCache) SetUint64(ctx context.Context, key string, value uint64, expiration time.Duration) error
- type RemoteCache
- type TieredCache
- func (cache *TieredCache) DeleteByPrefix(prefix string) error
- func (cache *TieredCache) Get(key string, returnValue interface{}) (interface{}, error)
- func (cache *TieredCache) GetPageTypeStats() []*PageTypeStats
- func (cache *TieredCache) GetStats() *TieredCacheStats
- func (cache *TieredCache) Set(key string, value interface{}, expiration time.Duration) error
- type TieredCacheStats
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrCacheMiss error = errors.New("cache miss")
Functions ¶
This section is empty.
Types ¶
type PageTypeStats ¶ added in v1.20.4
PageTypeStats holds per-page-type cache statistics.
type RedisCache ¶
type RedisCache struct {
// contains filtered or unexported fields
}
func InitRedisCache ¶
func (*RedisCache) DeleteByPrefix ¶ added in v1.24.0
func (cache *RedisCache) DeleteByPrefix(ctx context.Context, prefix string) error
func (*RedisCache) Get ¶
func (cache *RedisCache) Get(ctx context.Context, key string, returnValue interface{}) (interface{}, error)
type RemoteCache ¶
type RemoteCache interface {
Set(ctx context.Context, key string, value any, expiration time.Duration) error
SetBytes(ctx context.Context, key string, value []byte, expiration time.Duration) error
SetString(ctx context.Context, key, value string, expiration time.Duration) error
SetUint64(ctx context.Context, key string, value uint64, expiration time.Duration) error
SetBool(ctx context.Context, key string, value bool, expiration time.Duration) error
Get(ctx context.Context, key string, returnValue any) (any, error)
GetBytes(ctx context.Context, key string) ([]byte, error)
GetString(ctx context.Context, key string) (string, error)
GetUint64(ctx context.Context, key string) (uint64, error)
GetBool(ctx context.Context, key string) (bool, error)
DeleteByPrefix(ctx context.Context, prefix string) error
}
type TieredCache ¶
type TieredCache struct {
// contains filtered or unexported fields
}
Tiered cache is a cache implementation combining a local & remote cache
func NewTieredCache ¶
func NewTieredCache(cacheSize int, redisAddress string, redisPrefix string, logger logrus.FieldLogger) (*TieredCache, error)
func (*TieredCache) DeleteByPrefix ¶ added in v1.24.0
func (cache *TieredCache) DeleteByPrefix(prefix string) error
DeleteByPrefix removes every entry whose key starts with prefix from both the local and (if configured) the remote cache. It is used to actively invalidate a group of related cached entries, e.g. all sort-order variants of a page after a forced refresh.
func (*TieredCache) Get ¶
func (cache *TieredCache) Get(key string, returnValue interface{}) (interface{}, error)
func (*TieredCache) GetPageTypeStats ¶ added in v1.20.4
func (cache *TieredCache) GetPageTypeStats() []*PageTypeStats
GetPageTypeStats iterates over all local cache entries and returns per-page-type (key prefix before first ':') statistics.
func (*TieredCache) GetStats ¶ added in v1.20.4
func (cache *TieredCache) GetStats() *TieredCacheStats
GetStats returns cache statistics.
type TieredCacheStats ¶ added in v1.20.4
type TieredCacheStats struct {
LocalEntryCount int64
LocalHitCount int64
LocalMissCount int64
LocalLookupCount int64
LocalHitRate float64
RemoteEnabled bool
SSZEnabled bool
SSZCompatTypes int
SSZIncompatTypes int
}
TieredCacheStats holds statistics about the tiered cache.
Click to show internal directories.
Click to hide internal directories.