cache

package
v8.4.5+incompatible Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 6, 2017 License: BSD-3-Clause, BSD-3-Clause Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// NoCache disables the cache for a particular request,
	// can be used as a middleware or called manually from the handler.
	NoCache = client.NoCache
)

Functions

func Cache

func Cache(bodyHandler context.Handler, expiration time.Duration) *client.Handler

Cache accepts two parameters first is the context.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 context.Handler, which you can use as your default router or per-route handler

All types of response can be cached, templates, json, text, anything.

You can add validators with this function.

func Handler

func Handler(expiration time.Duration) context.Handler

Handler accepts one single parameter: the cache Entry's expiration duration if the expiration <=2 seconds then expiration is taken by the "cache-control's maxage" header returns context.Handler.

It's the same as Cache and WrapHandler but it sets the "bodyHandler" to the next handler in the chain.

All types of response can be cached, templates, json, text, anything.

it returns a context.Handler which can be used as a middleware, for more options use the `Cache`.

Examples can be found at: https://github.com/kataras/iris/tree/master/_examples/#caching

func WrapHandler

func WrapHandler(bodyHandler context.Handler, expiration time.Duration) context.Handler

WrapHandler accepts two parameters first is the context.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 context.Handler, which you can use as your default router or per-route handler

All types of response can be cached, templates, json, text, anything.

it returns a context.Handler, for more options use the `Cache`

Types

This section is empty.

Directories

Path Synopsis
Package ruleset provides the basics rules which are being extended by rules.
Package ruleset provides the basics rules which are being extended by rules.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL