v1/vendor/chi-teck/drupal-code-generator/templates/service/request-policy/request-policy.twig

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;
}
}
}