1 | <?php |
||
14 | class QueryCacheContext implements CacheContextInterface { |
||
15 | |||
16 | /** |
||
17 | * The request stack. |
||
18 | * |
||
19 | * @var \Symfony\Component\HttpFoundation\RequestStack |
||
20 | */ |
||
21 | protected $requestStack; |
||
22 | |||
23 | /** |
||
24 | * Static cache of hashed cache contexts. |
||
25 | * |
||
26 | * @var \SplObjectStorage |
||
27 | */ |
||
28 | protected $contextCache; |
||
29 | |||
30 | /** |
||
31 | * Constructs a new QueryCacheContext class. |
||
32 | * |
||
33 | * @param \Symfony\Component\HttpFoundation\RequestStack $requestStack |
||
34 | * The request stack. |
||
35 | */ |
||
36 | public function __construct(RequestStack $requestStack) { |
||
40 | |||
41 | /** |
||
42 | * {@inheritdoc} |
||
43 | */ |
||
44 | public static function getLabel() { |
||
47 | |||
48 | /** |
||
49 | * {@inheritdoc} |
||
50 | */ |
||
51 | public function getContext() { |
||
80 | |||
81 | /** |
||
82 | * Produces an optimized hashed string of the query and variables. |
||
83 | * |
||
84 | * Sorts the variables by their key and eliminates whitespace from the query |
||
85 | * to enable better reuse of the cache entries. |
||
86 | * |
||
87 | * @param string $schema |
||
88 | * The schema id. |
||
89 | * @param string $query |
||
90 | * The graphql query string. |
||
91 | * @param array $variables |
||
92 | * The graphql query variables. |
||
93 | * |
||
94 | * @return string |
||
95 | * The hashed string containing. |
||
96 | */ |
||
97 | protected function getHash($schema = '', $query = '', array $variables = []) { |
||
107 | |||
108 | /** |
||
109 | * {@inheritdoc} |
||
110 | */ |
||
111 | public function getCacheableMetadata() { |
||
114 | |||
115 | } |
||
116 |