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
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.
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.
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.