sebak: boscoin.io/sebak/lib/network/httpcache Index | Files

package httpcache

import "boscoin.io/sebak/lib/network/httpcache"

Index

Package Files

client.go config.go mem.go nop.go redis.go types.go

type Adapter Uses

type Adapter interface {
    Get(key string) (*Response, bool)
    Set(key string, response *Response, expiration time.Time)
    Remove(key string)
}

func NewAdapter Uses

func NewAdapter(cfg common.Config) (Adapter, error)

type Client Uses

type Client struct {
    // contains filtered or unexported fields
}

func NewClient Uses

func NewClient(opts ...ClientOption) (*Client, error)

func (*Client) Middleware Uses

func (c *Client) Middleware(next http.Handler) http.Handler

func (*Client) WrapHandlerFunc Uses

func (c *Client) WrapHandlerFunc(handlerFunc http.HandlerFunc) http.HandlerFunc

type ClientOption Uses

type ClientOption func(c *Client) error

func WithAdapter Uses

func WithAdapter(a Adapter) ClientOption

func WithExpire Uses

func WithExpire(ttl time.Duration) ClientOption

func WithLogger Uses

func WithLogger(logger logging.Logger) ClientOption

func WithMethods Uses

func WithMethods(methods ...string) ClientOption

func WithOptions Uses

func WithOptions(options ...ClientOption) ClientOption

func WithStatusCode Uses

func WithStatusCode(code int, ttl time.Duration) ClientOption

type MemCacheAdapter Uses

type MemCacheAdapter struct {
    // contains filtered or unexported fields
}

func NewMemCacheAdapter Uses

func NewMemCacheAdapter(size int) *MemCacheAdapter

func (*MemCacheAdapter) Get Uses

func (a *MemCacheAdapter) Get(key string) (*Response, bool)

func (*MemCacheAdapter) Remove Uses

func (a *MemCacheAdapter) Remove(key string)

func (*MemCacheAdapter) Set Uses

func (a *MemCacheAdapter) Set(key string, resp *Response, expir time.Time)

type NopClient Uses

type NopClient struct {
}

func NewNopClient Uses

func NewNopClient() *NopClient

func (NopClient) WrapHandlerFunc Uses

func (NopClient) WrapHandlerFunc(handlerFunc http.HandlerFunc) http.HandlerFunc

type RedisCacheAdapter Uses

type RedisCacheAdapter struct {
    // contains filtered or unexported fields
}

func NewRedisCacheAdapter Uses

func NewRedisCacheAdapter(opt *RedisRingOptions) *RedisCacheAdapter

func (*RedisCacheAdapter) Get Uses

func (a *RedisCacheAdapter) Get(key string) (*Response, bool)

func (*RedisCacheAdapter) Remove Uses

func (a *RedisCacheAdapter) Remove(key string)

func (*RedisCacheAdapter) Set Uses

func (a *RedisCacheAdapter) Set(key string, resp *Response, expir time.Time)

type RedisRingOptions Uses

type RedisRingOptions redis.RingOptions

type Response Uses

type Response struct {
    Value      []byte
    StatusCode int
    Header     http.Header
    Expiration time.Time
}

type Wrapper Uses

type Wrapper interface {
    WrapHandlerFunc(handlerFunc http.HandlerFunc) http.HandlerFunc
}

Package httpcache imports 15 packages (graph) and is imported by 3 packages. Updated 2019-03-27. Refresh now. Tools for package owners.