Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
Functions ¶
Types ¶
type Cacher ¶
type Cacher interface {
io.Closer
// Fetch retrieves the item from the cache. If the item does not exist,
// calls given FetchFunc to create a new item and sets to the cache.
Fetch(ctx context.Context, key string, value interface{}, fetchFunc FetchFunc) error
// Get gets an item for the given computeKey.
Get(ctx context.Context, key string, value interface{}) error
// Set adds an item to the cache.
Set(ctx context.Context, key string, value interface{}) error
// Exists returns a true if the given computeKey is exists, otherwise false.
Exists(ctx context.Context, key string) (bool, error)
// Delete removes an item from the cache.
Delete(ctx context.Context, key string) error
}
type RedisConfig ¶
type RedisConfig struct {
Cluster bool `json:"cluster" yaml:"cluster"`
Endpoints []string `json:"endpoints" yaml:"endpoints"`
ReadTimeout time.Duration `json:"read-timeout" yaml:"read-timeout"`
WriteTimeout time.Duration `json:"write-timeout" yaml:"write-timeout"`
DialTimeout time.Duration `json:"dial-timeout" yaml:"dial-timeout"`
PoolSize int `json:"pool-size" yaml:"pool-size"`
PoolTimeout time.Duration `json:"pool-timeout" yaml:"pool-timeout"`
MaxConnAge time.Duration `json:"max-conn-age" yaml:"max-conn-age"`
IdleTimeout time.Duration `json:"idle-timeout" yaml:"idle-timeout"`
}
Click to show internal directories.
Click to hide internal directories.