3 namespace Drupal\toolbar\PageCache;
5 use Drupal\Core\PageCache\RequestPolicyInterface;
6 use Symfony\Component\HttpFoundation\Request;
9 * Cache policy for the toolbar page cache service.
11 * This policy allows caching of requests directed to /toolbar/subtrees/{hash}
12 * even for authenticated users.
14 class AllowToolbarPath implements RequestPolicyInterface {
19 public function check(Request $request) {
20 // Note that this regular expression matches the end of pathinfo in order to
21 // support multilingual sites using path prefixes.
22 if (preg_match('#/toolbar/subtrees/[^/]+(/[^/]+)?$#', $request->getPathInfo())) {