grammar?

Gerasimos (Makis) Maropoulos 2019-07-21 01:22:24 +03:00
parent ef1ed7d288
commit ca02738962
No known key found for this signature in database
GPG Key ID: F169457BBDA4ACF4

@ -1,4 +1,4 @@
Sometimes is important to cache routes that serve static content to make your web app performs faster and not spend time on re-building a response to the client. Sometimes is important to cache routes that serve static content to make your web app performs faster and not spend time on re-building a response for clients.
There are two ways to achieve HTTP caching. One is to store the contents per handler on the server-side and the other is by checking some headers and send `304 not modified` in order to let the browser or any compatible client to handle the caching by itself. There are two ways to achieve HTTP caching. One is to store the contents per handler on the server-side and the other is by checking some headers and send `304 not modified` in order to let the browser or any compatible client to handle the caching by itself.
@ -12,15 +12,13 @@ Let's see their outline.
to the next handlers, can be used as: `app.Get("/", iris.Cache, aboutHandler)`. to the next handlers, can be used as: `app.Get("/", iris.Cache, aboutHandler)`.
`Cache` accepts one single parameter: `Cache` accepts one single parameter: the cache expiration duration.
the cache expiration duration If the expiration is invalid value, <=2 seconds, then expiration is taken by the "cache-control's maxage" header
if the expiration <=2 seconds then expiration is taken by the "cache-control's maxage" header
returns context.Handler.
All types of response can be cached, templates, json, text, anything. All types of response can be cached, templates, json, text, anything.
Use it for server-side caching, see the `Cache304` for an alternative approach that Use it for server-side caching, see the `Cache304` for an alternative approach that
may fit your needs most. might fit your needs the most.
```go ```go
func Cache(expiration time.Duration) Handler func Cache(expiration time.Duration) Handler