@@ -17,12 +17,10 @@ concept is to use event subscribers on the HttpCache class.
1717
1818.. warning ::
1919
20- Symfony HttpCache support is currently limited to following features:
20+ Symfony HttpCache does not currently provide support for banning.
2121
22- * User context
23-
24- Extending the right HttpCache
25- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
22+ Extending the Correct HttpCache Class
23+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2624
2725Instead of extending ``Symfony\Component\HttpKernel\HttpCache\HttpCache ``, your
2826``AppCache `` should extend ``FOS\HttpCache\SymfonyCache\EventDispatchingHttpCache ``.
@@ -59,6 +57,60 @@ subscribers there. A simple cache will look like this::
5957 }
6058 }
6159
60+ Purge
61+ ~~~~~
62+
63+ To support :ref: `cache purging <proxy-client purge >`, register the
64+ ``PurgeSubscriber ``. If the default settings are right for you, you don't
65+ need to do anything more.
66+
67+ Purging is only allowed from the same machine by default. To purge data from
68+ other hosts, provide the IPs of the machines allowed to purge, or provide a
69+ RequestMatcher that checks for an Authorization header or similar. *Only set
70+ one of purge_client_ips or purge_client_matcher *.
71+
72+ * **purge_client_ips **: String with IP or array of IPs that are allowed to
73+ purge the cache.
74+
75+ **default **: ``127.0.0.1 ``
76+
77+ * **purge_client_matcher **: RequestMatcher that only matches requests that are
78+ allowed to purge.
79+
80+ **default **: ``null ``
81+
82+ * **purge_method **: HTTP Method used with purge requests.
83+
84+ **default **: ``PURGE ``
85+
86+ Refresh
87+ ~~~~~~~
88+
89+ To support :ref: `cache refresh <proxy-client refresh >`, register the
90+ ``RefreshSubscriber ``. You can pass the constructor an option to specify
91+ what clients are allowed to refresh cache entries. Refreshing is only allowed
92+ from the same machine by default. To refresh from other hosts, provide the
93+ IPs of the machines allowed to refresh, or provide a RequestMatcher that
94+ checks for an Authorization header or similar. *Only set one of
95+ refresh_client_ips or refresh_client_matcher *.
96+
97+ The refresh subscriber needs to access the ``HttpCache::fetch `` method which
98+ is protected on the base HttpCache class. The ``EventDispatchingHttpCache ``
99+ exposes the method as public, but if you implement your own kernel, you need
100+ to overwrite the method to make it public.
101+
102+ * **refresh_client_ips **: String with IP or array of IPs that are allowed to
103+ refresh the cache.
104+
105+ **default **: ``127.0.0.1 ``
106+
107+ * **refresh_client_matcher **: RequestMatcher that only matches requests that are
108+ allowed to refresh.
109+
110+ **default **: ``null ``
111+
112+ .. _symfony-cache user context :
113+
62114User Context
63115~~~~~~~~~~~~
64116
@@ -102,8 +154,8 @@ constructor:
102154 Session IDs are indeed used as keys to cache the generated use context hash.
103155
104156 Wrong session name will lead to unexpected results such as having the same
105- user context hash for every users,
106- or not having it cached at all (painful for performance.
157+ user context hash for every users, or not having it cached at all, which
158+ hurts performance.
107159
108160Cleaning the Cookie Header
109161^^^^^^^^^^^^^^^^^^^^^^^^^^
0 commit comments