@@ -36,18 +36,19 @@ control headers from the server as specified in :rfc:`7234`. It needs a
36
36
Options
37
37
-------
38
38
39
- The third parameter to the ``CachePlugin `` constructor takes an array of options. The plugin has 3 options you can
40
- configure. Their default values and meaning is described by the table below.
41
-
42
- +---------------------------+---------------+------------------------------------------------------+
43
- | Name | Default value | Description |
44
- +===========================+===============+======================================================+
45
- | ``default_ttl `` | ``0 `` | The default max age of a Response |
46
- +---------------------------+---------------+------------------------------------------------------+
47
- | ``respect_cache_headers `` | ``true `` | Whatever or not we should care about cache headers |
48
- +---------------------------+---------------+------------------------------------------------------+
49
- | ``cache_lifetime `` | 30 days | The minimum time we should store a cache item |
50
- +---------------------------+---------------+------------------------------------------------------+
39
+ The third parameter to the ``CachePlugin `` constructor takes an array of options. The available options are:
40
+
41
+ +---------------------------+---------------------+------------------------------------------------------+
42
+ | Name | Default value | Description |
43
+ +===========================+=====================+======================================================+
44
+ | ``default_ttl `` | ``0 `` | The default max age of a Response |
45
+ +---------------------------+---------------------+------------------------------------------------------+
46
+ | ``respect_cache_headers `` | ``true `` | Whether we should care about cache headers or not |
47
+ +---------------------------+---------------------+------------------------------------------------------+
48
+ | ``cache_lifetime `` | 30 days | The minimum time we should store a cache item |
49
+ +---------------------------+---------------------+------------------------------------------------------+
50
+ | ``methods `` | ``['GET', 'HEAD'] `` | Which request methods to cache |
51
+ +---------------------------+---------------------+------------------------------------------------------+
51
52
52
53
.. note ::
53
54
@@ -103,7 +104,23 @@ removed from the cache::
103
104
'cache_lifetime' => 86400*365, // one year
104
105
];
105
106
107
+ Caching of different request methods
108
+ ````````````````````````````````````
106
109
110
+ Most of the time you should not change the ``methods `` option. However if you are working for example with HTTPlug
111
+ based SOAP client you might want to additionally enable caching of ``POST `` requests::
112
+
113
+ $options = [
114
+ 'methods' => ['GET', 'HEAD', 'POST'],
115
+ ];
116
+
117
+ The ``methods `` setting overrides the defaults. If you want to keep caching ``GET `` and ``HEAD `` requests, you need
118
+ to include them. You can specify any uppercase request method which conforms to :rfc: `7230 `.
119
+
120
+ .. note ::
121
+
122
+ If your system has both normal and SOAP clients you need to use two different ``PluginClient `` instances. SOAP
123
+ client should use ``PluginClient `` with POST caching enabled and normal client with POST caching disabled.
107
124
108
125
Cache Control Handling
109
126
----------------------
0 commit comments