Documentation
¶
Index ¶
- func CreateCacheReverseProxy(cache Cache, opts ...Option) (*httputil.ReverseProxy, error)
- func ServeCacheReverseProxy(keygen RequestCacheKeyFunc, cache Cache, proxy *httputil.ReverseProxy) func(http.ResponseWriter, *http.Request)
- type Cache
- type CommonCache
- func (c *CommonCache) Delete(ctx context.Context, key string) error
- func (c *CommonCache) Exists(ctx context.Context, key string) (bool, error)
- func (c *CommonCache) Header(ctx context.Context, key string) (http.Header, error)
- func (c *CommonCache) Load(ctx context.Context, key string) (http.Header, io.Reader, error)
- func (c *CommonCache) Save(ctx context.Context, key string, header http.Header, reader io.Reader) error
- type Option
- type ProxyConfig
- type RequestCacheKeyFunc
- type ResponseCacheCheckFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateCacheReverseProxy ¶
func CreateCacheReverseProxy(cache Cache, opts ...Option) (*httputil.ReverseProxy, error)
func ServeCacheReverseProxy ¶
func ServeCacheReverseProxy(keygen RequestCacheKeyFunc, cache Cache, proxy *httputil.ReverseProxy) func(http.ResponseWriter, *http.Request)
Types ¶
type Cache ¶
type Cache interface { Exists(ctx context.Context, key string) (bool, error) Delete(ctx context.Context, key string) error Save(ctx context.Context, key string, header http.Header, reader io.Reader) error Load(ctx context.Context, key string) (http.Header, io.Reader, error) Header(ctx context.Context, key string) (http.Header, error) }
type CommonCache ¶
type CommonCache struct {
// contains filtered or unexported fields
}
func NewByteCache ¶
type Option ¶
type Option = func(*ProxyConfig)
func WithCacheKeyFunc ¶
func WithCacheKeyFunc(cacheKeyFunc RequestCacheKeyFunc) Option
func WithDirector ¶
func WithResponseCacheCheck ¶
func WithResponseCacheCheck(checker ResponseCacheCheckFunc) Option
func WithTargetURL ¶
type ProxyConfig ¶
type ProxyConfig struct {
// contains filtered or unexported fields
}
func NewProxyConfig ¶
func NewProxyConfig(opts ...Option) *ProxyConfig
type RequestCacheKeyFunc ¶
type ResponseCacheCheckFunc ¶
Click to show internal directories.
Click to hide internal directories.