Documentation
¶
Index ¶
- func CreateCacheReverseProxy(cache Cache, opts ...Option) (*httputil.ReverseProxy, error)
- func ServeCacheReverseProxy(cache Cache, proxy *httputil.ReverseProxy, opts ...ServeOption) 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.ReadCloser, error)
- func (c *CommonCache) Save(ctx context.Context, key string, header http.Header, reader io.Reader) error
- type Option
- type Options
- type RequestCacheKeyFunc
- type ResponseCacheCheckFunc
- type ServeOption
- type ServeOptions
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(cache Cache, proxy *httputil.ReverseProxy, opts ...ServeOption) 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.ReadCloser, 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(*Options)
func WithCacheKeyFunc ¶
func WithCacheKeyFunc(cacheKeyFunc RequestCacheKeyFunc) Option
func WithDirector ¶
func WithErrorHandler ¶ added in v0.0.3
func WithResponseCacheCheck ¶
func WithResponseCacheCheck(checker ResponseCacheCheckFunc) Option
func WithTargetURL ¶
type RequestCacheKeyFunc ¶
type ResponseCacheCheckFunc ¶
type ServeOption ¶ added in v0.0.3
type ServeOption = func(*ServeOptions)
func WithServeCacheKeyFunc ¶ added in v0.0.3
func WithServeCacheKeyFunc(keygen RequestCacheKeyFunc) ServeOption
func WithServeErrorHandler ¶ added in v0.0.3
func WithServeErrorHandler(handler func(http.ResponseWriter, *http.Request, error)) ServeOption
type ServeOptions ¶ added in v0.0.3
type ServeOptions struct {
// contains filtered or unexported fields
}
Click to show internal directories.
Click to hide internal directories.