Skip to content

Commit 01b6add

Browse files
committed
removing obsolete documentation about the cache kernel and refer to the library documentation instead
1 parent 9d7d4ec commit 01b6add

File tree

1 file changed

+5
-57
lines changed

1 file changed

+5
-57
lines changed

Resources/doc/features/symfony-http-cache.rst

+5-57
Original file line numberDiff line numberDiff line change
@@ -22,65 +22,13 @@ concept is to use event listeners on the HttpCache class.
2222

2323
Generic ``BAN`` operations are not supported.
2424

25-
Extending the correct HttpCache
26-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
25+
Event Dispatching HttpCache
26+
~~~~~~~~~~~~~~~~~~~~~~~~~~~
2727

28-
Instead of extending ``Symfony\Bundle\FrameworkBundle\HttpCache\HttpCache``, your
29-
``AppCache`` should extend ``FOS\HttpCacheBundle\SymfonyCache\EventDispatchingHttpCache``::
28+
You need to adjust your ``AppCache`` to support event handling and register the
29+
cache event listeners for the functionality you want to use.
3030

31-
require_once __DIR__.'/AppKernel.php';
32-
33-
use FOS\HttpCacheBundle\SymfonyCache\EventDispatchingHttpCache;
34-
35-
class AppCache extends EventDispatchingHttpCache
36-
{
37-
}
38-
39-
.. tip::
40-
41-
If your class already needs to extend a different class, simply copy the event
42-
handling code from the ``EventDispatchingHttpCache`` into your ``AppCache`` class.
43-
The drawback is that you need to manually check whether you need to adjust your
44-
``AppCache`` each time you update the FOSHttpCache library.
45-
46-
By default, the event dispatching cache kernel registers all event listeners it
47-
knows about. You can disable listeners, or customize how they are instantiated.
48-
49-
If you do not need all listeners, or need to register some yourself to
50-
customize their behavior, overwrite ``getOptions`` and return the right bitmap
51-
in ``fos_default_subscribers``. Use the constants provided by the
52-
``EventDispatchingHttpCache``::
53-
54-
public function getOptions()
55-
{
56-
return array(
57-
'fos_default_subscribers' => self::SUBSCRIBER_NONE,
58-
);
59-
}
60-
61-
To register event listeners that you want to instantiate yourself in the cache
62-
kernel, overwrite ``getDefaultSubscribers``::
63-
64-
use FOS\HttpCache\SymfonyCache\UserContextSubscriber;
65-
66-
// ...
67-
68-
public function getDefaultSubscribers()
69-
{
70-
// get enabled listeners with default settings
71-
$subscribers = parent::getDefaultSubscribers();
72-
73-
$subscribers[] = new UserContextListener(array(
74-
'session_name_prefix' => 'eZSESSID',
75-
));
76-
77-
$subscribers[] = new CustomListener();
78-
79-
return $subscribers;
80-
}
81-
82-
You can also register event listeners from outside the kernel, e.g. in your
83-
``app.php`` with the ``addListener`` and ``addSubscriber`` methods.
31+
To adjust your cache kernel, follow the instructions in the :ref:`FOSHttpCache Symfony Cache documentation section <foshttpcache:symfony httpcache configuration>`.
8432

8533
.. warning::
8634

0 commit comments

Comments
 (0)