Documentation ¶
Index ¶
- Constants
- func CopyHeaders(dst, src http.Header)
- func IsReqCache(req *http.Request) bool
- func IsRespCache(resp *http.Response) bool
- func NewCachePool(cachePoolType CachePoolType) api.CachePool
- type CachePoolType
- type CacheReplacementPolicy
- type HttpCache
- type MemConnCachePool
- type RedisConnCachePool
Constants ¶
View Source
const ( Mem = iota Redis )
View Source
const ( LRU = iota LFU )
Variables ¶
This section is empty.
Functions ¶
func CopyHeaders ¶
CopyHeaders copies headers from source to destination. Nothing would be returned.
func IsReqCache ¶
IsReqCache checks whether request ask to be stored as cache
func IsRespCache ¶
IsRespCache checks whether response can be stored as cache
func NewCachePool ¶
func NewCachePool(cachePoolType CachePoolType) api.CachePool
Types ¶
type CachePoolType ¶ added in v1.0.1
type CachePoolType int
type CacheReplacementPolicy ¶ added in v1.0.1
type CacheReplacementPolicy int
type HttpCache ¶
type HttpCache struct { Header http.Header `json:"header"` Body []byte `json:"body"` StatusCode int `json:"status_code"` URI string `json:"url"` LastModified string `json:"last_modified"` //eg:"Fri, 27 Jun 2014 07:19:49 GMT" ETag string `json:"etag"` MustVerified bool `json:"must_verified"` //Validity is a time when to verify the cache again. Validity time.Time `json:"validity"` // contains filtered or unexported fields }
func NewCacheResp ¶
type MemConnCachePool ¶ added in v1.0.1
type MemConnCachePool struct {
// contains filtered or unexported fields
}
func NewMemCachePool ¶ added in v1.0.1
func NewMemCachePool(cap int, crp CacheReplacementPolicy) *MemConnCachePool
func (*MemConnCachePool) CheckAndStore ¶ added in v1.0.1
func (*MemConnCachePool) Delete ¶ added in v1.0.1
func (c *MemConnCachePool) Delete(uri string)
type RedisConnCachePool ¶ added in v1.0.1
type RedisConnCachePool struct {
// contains filtered or unexported fields
}
func NewRedisCachePool ¶ added in v1.0.1
func NewRedisCachePool(address, password string, idleTimeout, cap, maxIdle int) *RedisConnCachePool
func (*RedisConnCachePool) CheckAndStore ¶ added in v1.0.1
func (*RedisConnCachePool) Delete ¶ added in v1.0.1
func (c *RedisConnCachePool) Delete(uri string)
func (*RedisConnCachePool) Get ¶ added in v1.0.1
func (c *RedisConnCachePool) Get(uri string) api.Cache
Click to show internal directories.
Click to hide internal directories.