craftcms / craftcms/cms

GraphQL: disable caching if `devMode` is on & `cacheDuration`

Open
#5,152 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
PHP
Stars
3.6k
Forks
705
Avg merge
1d 5h
Merged PRs (30d)
134

Description

It can be a little hairy to debug GraphQL since caching is enabled regardless of whether devMode is on or not:

https://github.com/craftcms/cms/blob/develop/src/services/Gql.php#L289

In addition, perhaps rather than passing in null for the duration (meaning cache forever):

https://github.com/craftcms/cms/blob/develop/src/services/Gql.php#L340

...perhaps it makes sense to use the cacheDuration general config setting (or at a new gqlCacheDuration) config setting, and use that?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading src/services/Gql.php around lines 289 and 340, then review the cacheDuration configuration setting linked in the issue. Decide whether devMode should disable caching and whether the existing setting or a new gqlCacheDuration should control the duration. Done means the GraphQL caching behavior follows the chosen configuration consistently.

Written by the indexing model from the issue text.

Assessment

Tech stack
graphql, php
Domain
api, performance
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.