Cache accepts the cache expiration duration. If the "maxAgeFunc" input argument is nil, then expiration is taken by the "cache-control's maxage" header. Returns a Handler structure which you can use to customize cache further. All types of response can be cached, templates, json, text, anything. U
(maxAgeFunc client.MaxAgeFunc)
| 75 | // |
| 76 | // You can add validators with this function. |
| 77 | func Cache(maxAgeFunc client.MaxAgeFunc) *client.Handler { |
| 78 | if maxAgeFunc == nil { |
| 79 | maxAgeFunc = DefaultMaxAge |
| 80 | } |
| 81 | |
| 82 | return client.NewHandler(maxAgeFunc) |
| 83 | } |
| 84 | |
| 85 | // Handler like `Cache` but returns an Iris Handler to be used as a middleware. |
| 86 | // For more options use the `Cache`. |
searching dependent graphs…