Skip to content

Commit c617efe

Browse files
authored
Merge pull request #188 from Nyholm/patch-cache-key
Adding docs about cache key generators.
2 parents d47ed02 + ca08979 commit c617efe

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

plugins/cache.rst

+12
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,9 @@ The third parameter to the ``CachePlugin`` constructor takes an array of options
6767
+---------------------------------------+----------------------------------------------------+-----------------------------------------------------------------------+
6868
| ``respect_response_cache_directives`` | ``['no-cache', 'private', 'max-age', 'no-store']`` | A list of cache directives to respect when caching responses |
6969
+---------------------------------------+----------------------------------------------------+-----------------------------------------------------------------------+
70+
| ``cache_key_generator`` | ``new SimpleGenerator()`` | A class implementing ``CacheKeyGenerator`` to generate a PSR-6 cache |
71+
| | | key. |
72+
+---------------------------------------+----------------------------------------------------+-----------------------------------------------------------------------+
7073

7174
.. note::
7275

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

95+
96+
Generating a cache key
97+
``````````````````````
98+
99+
You may define a method how the PSR-6 cache key should be generated. The default generator is ``SimpleGenerator`` which
100+
is using the request method, URI and body of the request. The cache plugin does also include a ``HeaderCacheKeyGenerator``
101+
which allow you to specify what HTTP header you want include in the cache key.
102+
103+
92104
Semantics of null values
93105
````````````````````````
94106

0 commit comments

Comments
 (0)