Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Caching queries with variables #10

Open
hatsumatsu opened this issue Mar 24, 2021 · 1 comment
Open

Caching queries with variables #10

hatsumatsu opened this issue Mar 24, 2021 · 1 comment

Comments

@hatsumatsu
Copy link

Thanks for this plugin!

I was wondering how caching a named query with query variables works. Let's say I have a paginated query using the after filter.

query MyPosts( $after: String ) {
  posts(after: $after, first: 10) {
    edges {
      node {
        title
      }
    }
  }
}

Would caching query MyPosts (see below) automatically handle different versions of the query based on the passed variables? Or does it ignore variables all together?

use WPGraphQL\Extensions\Cache\CacheManager;

CacheManager::register_graphql_query_cache([
    'query_name' => 'MyPosts',
    'expire' => 120,
]);
@blocka
Copy link

blocka commented Jun 13, 2021

seems like would ignore them? I think this would be a very useful feature

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants