plug_response_cache v0.1.1 PlugResponseCache.Profile behaviour View Source

Link to this section Summary

Callbacks

Determines whether or not the request should be cached or retrieved from the cache. This callback gets executed before the request is handled by your application

Determines whether or not the request should be cached. This callback gets executed after the request is handled by your application

Returns the expiration time of the cached response in the UTC timezone. Returns a :never atom. If the response shouldn’t expire automatically

Link to this section Callbacks

Link to this callback cache_request?(arg0, arg1) View Source
cache_request?(Plug.Conn.t(), Map.t()) :: boolean()

Determines whether or not the request should be cached or retrieved from the cache. This callback gets executed before the request is handled by your application.

The default profile checks the request type here, since it only caches “GET” requests.

Link to this callback cache_response?(arg0, arg1) View Source
cache_response?(Plug.Conn.t(), Map.t()) :: boolean()

Determines whether or not the request should be cached. This callback gets executed after the request is handled by your application.

The default profile checks the response code here, since it only caches successful responses.

Link to this callback expires(arg0, arg1) View Source
expires(Plug.Conn.t(), Map.t()) :: DateTime.t() | :never

Returns the expiration time of the cached response in the UTC timezone. Returns a :never atom. If the response shouldn’t expire automatically.