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

Remove WP Engine specific code #246

Closed
markkelnar opened this issue Aug 9, 2023 · 2 comments
Closed

Remove WP Engine specific code #246

markkelnar opened this issue Aug 9, 2023 · 2 comments
Assignees

Comments

@markkelnar
Copy link
Contributor

There still remains some WP Engine specific code related to early development to integration with network (Varnish) caching on the WP Engine platform. This exists as a hook that listens to the purge functionality and calls some WPE specific code that only runs on that platform in that WPE plugin.

Removing here and working to make sure it doesn't break behavior for WPE users. That code, or similar actions, should exist before this issue is closed.

@markkelnar
Copy link
Contributor Author

markkelnar commented Aug 18, 2023

With these two proposed changes and one to the wpengine plugin (it is private therefore not visible here). The following describes current behavior and what we want to get to.

Existing/deployed wpengine plugin:

  • registers for graphql_purge action.
  • accepts cache key
  • parses home_url() to use just 'host' as the X-GraphQL-URL cache domain/url value. Ex. domain.com.
  • this purge action fires from smart-cache purge() and sends a purge request to varnish, but the domain/url key doesn't match what currently comes out of wp-graphql plugin. So technically doesn't invalidate anything. it is noise.

Existing wp-graphql

Existing wp-graphql-smart-cache

  • Also registers for graphql_purge action.. accepts cache key
  • On purge, sends an http request directly to varnish using WPE plugin function telling it what cache key and domain to purge. Uses graphql_endpoint as the X-GraphQL-URL cache domain/url value. Ex. https://domain.com/graphql or https://domain.com/subsite/graphql
  • This works because it matches what wp-graphql uses as X-GraphQL-URL header. Ie, part of the cache key used by varnish.

Plugin changes:

wpengine plugin

  • register for graphql_purge action
  • accepts cache key and url
  • this action fires from smart-cache purge() and sends purge request to varnish. url will be from new smart cache plugin (See below) if that plugin is updated. New behavior once this argument is passed to purge event.
  • if url not present, use home_url 'host' as before. No change in behavior here.

wp-graphql

  • on request return header X-GraphQL-URL, sends graphql_endpoint() minus https://. Ex domain.com/graphql or domain.com/subsite/graphql.
  • This is a change of the cache keys.

smart-cache

  • when purge(), do not call wpengine code directly. instead do_action( 'graphql_purge' )
  • give the action the cache key and the hostname from graphql_endpoint() minus https://. Ex domain.com/graphql or domain.com/subsite/graphql. This will match what the new wp-graphql plugin will be using.

Conclusion

Can make wpengine plugin update even with old smart cache and graphql plugins. action with new arguments will be fine because is defined with default value of =''. Will fire but until new wp-graphql and smart-cache plugins, url hostname will not invalidate anything.

smart-cache and wp-graphql

  • should be updated together to get benefit of cache invalidation

If wp-graphql plugin is updated alone, the domain/url cache parameter will not match what is invalidated by an older version of smart-cache nor wpengine plugin.

@jasonbahl
Copy link
Collaborator

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