@@ 112-123 (lines=12) @@ | ||
109 | * |
|
110 | * Adding the Events::PRE_HANDLE event. |
|
111 | */ |
|
112 | public function handle(Request $request, $type = HttpKernelInterface::MASTER_REQUEST, $catch = true) |
|
113 | { |
|
114 | if ($this->getEventDispatcher()->hasListeners(Events::PRE_HANDLE)) { |
|
115 | $event = new CacheEvent($this, $request); |
|
116 | $this->getEventDispatcher()->dispatch(Events::PRE_HANDLE, $event); |
|
117 | if ($event->getResponse()) { |
|
118 | return $event->getResponse(); |
|
119 | } |
|
120 | } |
|
121 | ||
122 | return parent::handle($request, $type, $catch); |
|
123 | } |
|
124 | ||
125 | /** |
|
126 | * Add a cache kernel event subscriber that listens to events listed in |
|
@@ 151-162 (lines=12) @@ | ||
148 | * |
|
149 | * Adding the Events::PRE_INVALIDATE event. |
|
150 | */ |
|
151 | protected function invalidate(Request $request, $catch = false) |
|
152 | { |
|
153 | if ($this->getEventDispatcher()->hasListeners(Events::PRE_INVALIDATE)) { |
|
154 | $event = new CacheEvent($this, $request); |
|
155 | $this->getEventDispatcher()->dispatch(Events::PRE_INVALIDATE, $event); |
|
156 | if ($event->getResponse()) { |
|
157 | return $event->getResponse(); |
|
158 | } |
|
159 | } |
|
160 | ||
161 | return parent::invalidate($request, $catch); |
|
162 | } |
|
163 | ||
164 | /** |
|
165 | * Return the subscribers to be added to the event dispatcher, according to the |