httpcache: github.com/GeekyPanda/httpcache Index | Files | Directories

package httpcache

import "github.com/GeekyPanda/httpcache"

Index

Package Files

httpcache.go

Constants

const (
    // Version is the release version number of the httpcache package.
    Version = "0.0.5"
)

Variables

var (
    // NoCache called when a particular handler is not valid for cache.
    // If this function called inside a handler then the handler is not cached
    // even if it's surrounded with the Cache/CacheFunc/CacheRemote wrappers.
    NoCache = nethttp.NoCache

    // NoCacheFasthttp called when a particular fasthttp RequestHandler is not valid for cache.
    // If this function called inside a handler then the handler is not cached
    // even if it's surrounded with the CacheFasthttp/CacheRemoteFasthttp wrapper.
    NoCacheFasthttp = fhttp.NoCache
)

func Cache Uses

func Cache(bodyHandler http.Handler, expiration time.Duration) *nethttp.Handler

Cache accepts two parameters first is the http.Handler which you want to cache its result the second is, optional, the cache Entry's expiration duration if the expiration <=2 seconds then expiration is taken by the "cache-control's maxage" header returns an http.Handler, which you can use as your default router or per-route handler

All type of responses are cached, templates, json, text, anything.

You can add validators with this function

func CacheFasthttp Uses

func CacheFasthttp(bodyHandler fasthttp.RequestHandler, expiration time.Duration) *fhttp.Handler

CacheFasthttp accepts two parameters first is the fasthttp.RequestHandler which you want to cache its result the second is, optional, the cache Entry's expiration duration if the expiration <=2 seconds then expiration is taken by the "cache-control's maxage" header returns a fhttp.Handler with a ServeHTTP which is the fasthttp.RequestHandler, which you can use as your default router or per-route handler

All type of responses are cached, templates, json, text, anything.

You can add validators with this function

func CacheFasthttpFunc Uses

func CacheFasthttpFunc(bodyHandler fasthttp.RequestHandler, expiration time.Duration) fasthttp.RequestHandler

CacheFasthttpFunc accepts two parameters first is the fasthttp.RequestHandler which you want to cache its result the second is, optional, the cache Entry's expiration duration if the expiration <=2 seconds then expiration is taken by the "cache-control's maxage" header returns a fasthttp.RequestHandler, which you can use as your default router or per-route handler

All type of responses are cached, templates, json, text, anything.

You CAN NOT add validators with this function

func CacheFunc Uses

func CacheFunc(bodyHandler func(http.ResponseWriter, *http.Request), expiration time.Duration) http.HandlerFunc

CacheFunc accepts two parameters first is the http.HandlerFunc which you want to cache its result the second is, optional, the cache Entry's expiration duration if the expiration <=2 seconds then expiration is taken by the "cache-control's maxage" header returns an http.HandlerFunc, which you can use as your default router or per-route handler

All type of responses are cached, templates, json, text, anything.

You CAN NOT add validators with this function

func CacheRemote Uses

func CacheRemote(bodyHandler http.Handler, expiration time.Duration, remoteServerAddr string) *nethttp.ClientHandler

CacheRemote receives a handler, its cache expiration and the remote address of the remote cache server(look ListenAndServe) returns a remote-cached handler

You can add validators with this function

func CacheRemoteFasthttp Uses

func CacheRemoteFasthttp(bodyHandler fasthttp.RequestHandler, expiration time.Duration, remoteServerAddr string) *fhttp.ClientHandler

CacheRemoteFasthttp receives a fasthttp handler, its cache expiration and the remote address of the remote cache server(look ListenAndServe) returns a remote-cached handler

You can add validators with this function

func CacheRemoteFasthttpFunc Uses

func CacheRemoteFasthttpFunc(bodyHandler fasthttp.RequestHandler, expiration time.Duration, remoteServerAddr string) fasthttp.RequestHandler

CacheRemoteFasthttpFunc receives a fasthttp handler, its cache expiration and the remote address of the remote cache server(look ListenAndServe) returns a remote-cached handler

You CAN NOT add validators with this function

func CacheRemoteFunc Uses

func CacheRemoteFunc(bodyHandler func(http.ResponseWriter, *http.Request), expiration time.Duration, remoteServerAddr string) http.HandlerFunc

CacheRemoteFunc receives a handler function, its cache expiration and the remote address of the remote cache server(look ListenAndServe) returns a remote-cached handler function

You CAN NOT add validators with this function

func ListenAndServe Uses

func ListenAndServe(addr string) error

ListenAndServe receives a network address and starts a server with a remote server cache handler registered to it which handles remote client-side cache handlers client should register its handlers with the RemoteCache & RemoteCacheFasthttp functions

Note: It doesn't starts the server,

Directories

PathSynopsis
cfg
entry
_examples
_examples/common
_examples/fasthttp
fhttp
fhttp/rule
httptest
nethttp
nethttp/rule
rulesetPackage ruleset provides the basics rules which are being extended bynethttp's and fhttp's rules.
server
uri

Package httpcache imports 6 packages (graph). Updated 2018-02-16. Refresh now. Tools for package owners. This is an inactive package (no imports and no commits in at least two years).