304 not modifiedin order to let the browser or any compatible client to handle the caching by itself.
Cacheis a middleware that provides server-side cache functionality to the next handlers, can be used as:
app.Get("/", iris.Cache, aboutHandler).
Cacheaccepts one single parameter: the cache expiration duration. If the expiration is invalid value, <=2 seconds, then expiration is taken by the "cache-control's maxage" header
Cache304for an alternative approach that may be more suited to your needs.
NoCacheis a middleware which overrides the Cache-Control, Pragma and Expires headers in order to disable the cache during the browser's back and forward feature.
StaticCachefor the opposite behavior.
StaticCachereturns a middleware for caching static files by sending the "Cache-Control" and "Expires" headers to the client. It accepts a single input parameter, the "cacheDur", a time.Duration that it's used to calculate the expiration.
NoCachemiddleware instaed to disable the caching between browser's "back" and "forward" actions.
app.Use(iris.StaticCache(24 * time.Hour))or
Cache304returns a middleware sends a
StatusNotModified(304) whenever the "If-Modified-Since" request header (time) is before the time.Now() + expiresEvery (always compared to their UTC values).
ctx.WriteWithExpirationwith a "modtime" based on the file modified date, similar to the
HandleDir(which sends status OK(200) and browser disk caching instead of 304).