Skip to content

Adding docs about cache key generators. #188

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 5, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions plugins/cache.rst
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@ The third parameter to the ``CachePlugin`` constructor takes an array of options
+---------------------------------------+----------------------------------------------------+-----------------------------------------------------------------------+
| ``respect_response_cache_directives`` | ``['no-cache', 'private', 'max-age', 'no-store']`` | A list of cache directives to respect when caching responses |
+---------------------------------------+----------------------------------------------------+-----------------------------------------------------------------------+
| ``cache_key_generator`` | ``new SimpleGenerator()`` | A class implementing ``CacheKeyGenerator`` to generate a PSR-6 cache |
| | | key. |
+---------------------------------------+----------------------------------------------------+-----------------------------------------------------------------------+

.. note::

Expand All @@ -89,6 +92,15 @@ for the default time to live. The options below will cache all responses for one
'respect_response_cache_directives' => [],
];


Generating a cache key
``````````````````````

You may define a method how the PSR-6 cache key should be generated. The default generator is ``SimpleGenerator`` which
is using the request method, URI and body of the request. The cache plugin does also include a ``HeaderCacheKeyGenerator``
which allow you to specify what HTTP header you want include in the cache key.


Semantics of null values
````````````````````````

Expand Down