-
Notifications
You must be signed in to change notification settings - Fork 56
Basic documentation of cache plugin methods option #174
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
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,18 +36,20 @@ control headers from the server as specified in :rfc:`7234`. It needs a | |
Options | ||
------- | ||
|
||
The third parameter to the ``CachePlugin`` constructor takes an array of options. The plugin has 3 options you can | ||
The third parameter to the ``CachePlugin`` constructor takes an array of options. The plugin has four options you can | ||
configure. Their default values and meaning is described by the table below. | ||
|
||
+---------------------------+---------------+------------------------------------------------------+ | ||
| Name | Default value | Description | | ||
+===========================+===============+======================================================+ | ||
| ``default_ttl`` | ``0`` | The default max age of a Response | | ||
+---------------------------+---------------+------------------------------------------------------+ | ||
| ``respect_cache_headers`` | ``true`` | Whatever or not we should care about cache headers | | ||
+---------------------------+---------------+------------------------------------------------------+ | ||
| ``cache_lifetime`` | 30 days | The minimum time we should store a cache item | | ||
+---------------------------+---------------+------------------------------------------------------+ | ||
+---------------------------+---------------------+------------------------------------------------------+ | ||
| Name | Default value | Description | | ||
+===========================+=====================+======================================================+ | ||
| ``default_ttl`` | ``0`` | The default max age of a Response | | ||
+---------------------------+---------------------+------------------------------------------------------+ | ||
| ``respect_cache_headers`` | ``true`` | Whatever or not we should care about cache headers | | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. s/Whatever/Whether/ (i see you only reformatted this, but just jumped into my eyes) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I believe "Whether we should care about cache headers or not" would be proper english. |
||
+---------------------------+---------------------+------------------------------------------------------+ | ||
| ``cache_lifetime`` | 30 days | The minimum time we should store a cache item | | ||
+---------------------------+---------------------+------------------------------------------------------+ | ||
| ``methods`` | ``['GET', 'HEAD']`` | Which request methods to cache | | ||
+---------------------------+---------------------+------------------------------------------------------+ | ||
|
||
.. note:: | ||
|
||
|
@@ -103,7 +105,22 @@ removed from the cache:: | |
'cache_lifetime' => 86400*365, // one year | ||
]; | ||
|
||
Caching of different request methods | ||
```````````````````````````````````` | ||
|
||
Most of the time you should not change the ``methods`` option. However if you are working for example with HTTPlug | ||
based SOAP client you might want to additionally enable caching of POST requests:: | ||
|
||
$options = [ | ||
'methods' => ['GET', 'HEAD', 'POST'], | ||
]; | ||
|
||
You can cache any valid request method. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. maybe: "methods" overwrites the default methods, if you want to keep caching GET and HEAD requests, you need to repeat them. You can specify any request method that conforms to RFC-7230. Note that request methods are case sensitive, so |
||
|
||
.. note:: | ||
|
||
If your system has both normal and SOAP clients you need to use two different ``PluginClient`` instances. SOAP | ||
client should use ``PluginClient`` with POST caching enabled and normal client with POST caching disabled. | ||
|
||
Cache Control Handling | ||
---------------------- | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe just:
"The available options are:"