This repository has been archived on 2025-01-19. You can view files and clone it, but cannot push or open issues or pull requests.
drupalcampbristol/vendor/chi-teck/drupal-code-generator/templates/d8/service/request-policy.twig
2018-11-23 12:29:20 +00:00

25 lines
502 B
Twig

<?php
namespace Drupal\{{ machine_name }}\PageCache;
use Drupal\Core\PageCache\RequestPolicyInterface;
use Symfony\Component\HttpFoundation\Request;
/**
* A policy allowing to bypass cache for requests with 'no-cache' parameter.
*
* Example: https://example.com/node?no-cache.
*/
class {{ class }} implements RequestPolicyInterface {
/**
* {@inheritdoc}
*/
public function check(Request $request) {
if (!is_null($request->get('no-cache'))) {
return self::DENY;
}
}
}