Documentation ¶
Overview ¶
Package httpcache introduces an in-memory-cached http client into the KrakenD stack
Index ¶
- Constants
- Variables
- func BackendFactory(cfg *config.Backend) proxy.BackendFactory
- func ConfigGetter(cfg *config.Backend) (interface{}, error)
- func NewHTTPClient(cfg *config.Backend) client.HTTPClientFactory
- func NewRedisCacheTransport(c Cache) *httpcache.Transport
- type Cache
- type Client
- type Config
- type RedisCache
- type RedisConfig
Constants ¶
View Source
const ( Namespace = "github.com/devopsfaith/krakend-httpcache" BackendMemory = "memory" BackendRedis = "redis" RedisModeRedis = "redis" RedisModeCluster = "rediscluster" RedisDefaultDialTimeout = 100 * time.Millisecond RedisDefaultReadTimeout = 100 * time.Millisecond RedisDefaultWriteTimeout = 200 * time.Millisecond RedisDefaultMaxRetries = 0 RedisDefaultIdleTimeout = 5 * time.Minute RedisDefaultIdleCheckFrequency = 1 * time.Minute RedisDefaultPoolSize = 10 RedisDefaultPoolTimeout = 10 * time.Millisecond RedisDefaultTtl = 1 * time.Hour )
Variables ¶
View Source
var ErrInvalidValue = func(field string) error { return errors.New(fmt.Sprintf("Invalid value for krakend-httpcache config field [%s]", field)) }
View Source
var ErrMappingConfig = errors.New("could not map krakend-httpcache config")
View Source
var ErrMissingRequired = func(field string) error { return errors.New(fmt.Sprintf("Missing required krakend-httpcache config field [%s]", field)) }
View Source
var WarnNoConfig = errors.New("no config found for krakend-httpcache")
Functions ¶
func BackendFactory ¶
func BackendFactory(cfg *config.Backend) proxy.BackendFactory
BackendFactory returns a proxy.BackendFactory that creates backend proxies using an in-memory-cached http client
func ConfigGetter ¶
func NewHTTPClient ¶
func NewHTTPClient(cfg *config.Backend) client.HTTPClientFactory
NewHTTPClient creates a HTTPClientFactory using an in-memory-cached http client
func NewRedisCacheTransport ¶
Types ¶
type Client ¶
type Client interface { redis.Cmdable }
func NewRedis ¶
func NewRedis(cfg RedisConfig) Client
func NewRedisCluster ¶
func NewRedisCluster(cfg RedisConfig) Client
type Config ¶
type Config struct { Type string RedisConfig RedisConfig }
type RedisCache ¶
type RedisCache struct {
// contains filtered or unexported fields
}
func NewRedisCache ¶
func NewRedisCache(client Client, ttl time.Duration) *RedisCache
func (*RedisCache) Delete ¶
func (c *RedisCache) Delete(key string)
func (*RedisCache) Set ¶
func (c *RedisCache) Set(key string, responseBytes []byte)
Click to show internal directories.
Click to hide internal directories.