Documentation
¶
Index ¶
- Constants
- func NewCacheManager(ctx context.Context, config types.ConfigManager, logger types.Logger, ...) (types.CacheManager, error)
- func NewMemoryCache(ctx context.Context, logger types.Logger, config *types.CacheConfig, ...) (types.CacheManager, error)
- func NewRedisCache(ctx context.Context, logger types.Logger, config *types.CacheConfig, ...) (types.CacheManager, error)
- func RegisterCacheManager(cacheManagerName string, creator types.CacheManagerCreator)
- type KeyBuilder
- type MemoryCache
- func (m *MemoryCache) BuildCacheKey(requestPath []byte, dependencies []string, metadata map[string][]byte) string
- func (m *MemoryCache) Delete(key string) error
- func (m *MemoryCache) Get(key string) (interface{}, bool)
- func (m *MemoryCache) GetRevision(key string) uint64
- func (m *MemoryCache) Invalidate(keys ...string) error
- func (m *MemoryCache) IsRunning() bool
- func (m *MemoryCache) Set(key string, value interface{}, ttl time.Duration) error
- func (m *MemoryCache) SetRevision(key string, revision uint64)
- func (m *MemoryCache) Start() error
- func (m *MemoryCache) Stop() error
- type MemoryConfig
- type MemoryState
- type RedisCache
- func (r *RedisCache) BuildCacheKey(requestPath []byte, dependencies []string, metadata map[string][]byte) string
- func (r *RedisCache) Delete(key string) error
- func (r *RedisCache) Get(key string) (interface{}, bool)
- func (r *RedisCache) GetRevision(key string) uint64
- func (r *RedisCache) Invalidate(keys ...string) error
- func (r *RedisCache) IsRunning() bool
- func (r *RedisCache) Set(key string, value interface{}, ttl time.Duration) error
- func (r *RedisCache) SetRevision(key string, revision uint64)
- func (r *RedisCache) Start() error
- func (r *RedisCache) Stop() error
- type RedisConfig
- type RedisState
- type State
Constants ¶
View Source
const ( MaxTTL = 24 * time.Hour DefaultTTL = 1 * time.Hour )
Variables ¶
This section is empty.
Functions ¶
func NewCacheManager ¶
func NewCacheManager(ctx context.Context, config types.ConfigManager, logger types.Logger, metrics types.MetricsManager, health types.HealthManager) (types.CacheManager, error)
func NewMemoryCache ¶
func NewMemoryCache(ctx context.Context, logger types.Logger, config *types.CacheConfig, health types.HealthManager) (types.CacheManager, error)
func NewRedisCache ¶
func NewRedisCache(ctx context.Context, logger types.Logger, config *types.CacheConfig, health types.HealthManager) (types.CacheManager, error)
func RegisterCacheManager ¶
func RegisterCacheManager(cacheManagerName string, creator types.CacheManagerCreator)
Types ¶
type KeyBuilder ¶
type KeyBuilder struct {
// contains filtered or unexported fields
}
type MemoryCache ¶
type MemoryCache struct {
// contains filtered or unexported fields
}
func (*MemoryCache) BuildCacheKey ¶
func (*MemoryCache) Delete ¶
func (m *MemoryCache) Delete(key string) error
func (*MemoryCache) Get ¶
func (m *MemoryCache) Get(key string) (interface{}, bool)
func (*MemoryCache) GetRevision ¶
func (m *MemoryCache) GetRevision(key string) uint64
func (*MemoryCache) Invalidate ¶
func (m *MemoryCache) Invalidate(keys ...string) error
func (*MemoryCache) IsRunning ¶
func (m *MemoryCache) IsRunning() bool
func (*MemoryCache) Set ¶
func (m *MemoryCache) Set(key string, value interface{}, ttl time.Duration) error
func (*MemoryCache) SetRevision ¶
func (m *MemoryCache) SetRevision(key string, revision uint64)
func (*MemoryCache) Start ¶
func (m *MemoryCache) Start() error
func (*MemoryCache) Stop ¶
func (m *MemoryCache) Stop() error
type MemoryConfig ¶
type MemoryState ¶
type MemoryState int32
const ( MemoryStateStopped MemoryState = iota MemoryStateStarting MemoryStateRunning MemoryStateStopping )
type RedisCache ¶
type RedisCache struct {
// contains filtered or unexported fields
}
func (*RedisCache) BuildCacheKey ¶
func (*RedisCache) Delete ¶
func (r *RedisCache) Delete(key string) error
func (*RedisCache) Get ¶
func (r *RedisCache) Get(key string) (interface{}, bool)
func (*RedisCache) GetRevision ¶
func (r *RedisCache) GetRevision(key string) uint64
func (*RedisCache) Invalidate ¶
func (r *RedisCache) Invalidate(keys ...string) error
func (*RedisCache) IsRunning ¶
func (r *RedisCache) IsRunning() bool
func (*RedisCache) Set ¶
func (r *RedisCache) Set(key string, value interface{}, ttl time.Duration) error
func (*RedisCache) SetRevision ¶
func (r *RedisCache) SetRevision(key string, revision uint64)
func (*RedisCache) Start ¶
func (r *RedisCache) Start() error
func (*RedisCache) Stop ¶
func (r *RedisCache) Stop() error
type RedisConfig ¶
type RedisConfig struct {
Host string `json:"host"`
Port int `json:"port"`
Password string `json:"password"`
DB int `json:"db"`
PoolSize int `json:"pool_size"`
MinIdleConnections int `json:"min_idle_connections"`
DialTimeout time.Duration `json:"dial_timeout"`
ReadTimeout time.Duration `json:"read_timeout"`
WriteTimeout time.Duration `json:"write_timeout"`
KeyPrefix string `json:"key_prefix"`
MaxDependencies int `json:"max_dependencies"`
MaxDependentsPerKey int `json:"max_dependents_per_key"`
}
type RedisState ¶
type RedisState int32
const ( RedisStateStopped RedisState = iota RedisStateStarting RedisStateRunning RedisStateStopping )
Click to show internal directories.
Click to hide internal directories.