From c33db521a048c713e0fe2709b6bbc8bfc0f91d18 Mon Sep 17 00:00:00 2001 From: Alec Geatches Date: Wed, 26 Feb 2025 12:31:01 -0700 Subject: [PATCH] Use default TTL in GraphQL queries --- inc/Config/Query/GraphqlQuery.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/inc/Config/Query/GraphqlQuery.php b/inc/Config/Query/GraphqlQuery.php index ac61d222..47f94806 100644 --- a/inc/Config/Query/GraphqlQuery.php +++ b/inc/Config/Query/GraphqlQuery.php @@ -34,4 +34,16 @@ public function get_request_body( array $input_variables ): array { public static function get_config_schema(): array { return ConfigSchemas::get_graphql_query_config_schema(); } + + /** + * GraphQL queries are typically made with POST requests, however, we do + * want to cache the response to queries. Override the default HTTP behavior + * for POST requests and allow caching. + * + * Caching policy for GraphQL mutations is separately handled and disabled. + */ + public function get_cache_ttl( array $input_variables ): int|null { + // Return null for default cache TTL. + return null; + } }