:cache plugin

the :cache plugin, extracted from the :response_cache plugin, acts as a subset of functionality which can be used to implement a custom cache strategy, or other cache plugins (like the :response_cache login, which now depends on it).

it's designed around 4 new callback options:

  • :cache_key ((request) -> String): returns a unique identifier where cache responses for the given request are stored
  • :cacheable_request ((request) -> bool): returns whether the request is cacheable and can use a cached response
  • :cacheable_response ((request, response) -> bool: returns whether the received response can be cached
  • :valid_cached_response ((request, response) -> bool: returns whether the (cached) response is still valid and can be returned.
  • :response_cache_store: same as the :response_cache option which returns the store instance.

some of the options of functionality and options of :response_cache plugin are moved to the new plugin as a result. renaming will follow deprecation rules.

Merge request reports

Loading