plug_response_cache v0.1.1 PlugResponseCache.Profiles.Default View Source
The default profile caches all successful GET requests for a specified duration in minutes. By default, it will cache the response forever.
- If a request has a different method that “GET”, it will be rejected
- If a response has a status equal to or higher that 400, it will be rejected
- The cache will keep the response for the duration of the
expiration_time
value (in minutes). If no expiration time is specified, it will be cached forever.
Link to this section Summary
Functions
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 Functions
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.
Callback implementation for PlugResponseCache.Profile.cache_request?/2
.
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.
Callback implementation for PlugResponseCache.Profile.cache_response?/2
.
Returns the expiration time of the cached response in the UTC timezone.
Returns a :never
atom. If the response shouldn’t expire automatically.
Callback implementation for PlugResponseCache.Profile.expires/2
.