manifest / performance / wp-graphql-cache
WPGraphQL Cache
Flexible caching framework for WPGraphQL
by Esa-Matti Suuronen, Valu Digital Oy · github.com/valu-digital/wp-graphql-cache · website
★ 42stars
22kcomposer installs
8forks
Install
No release zip yet. The repository archive installs, but the folder name will carry the branch suffix and updates will not flow:
wp plugin install https://github.com/valu-digital/wp-graphql-cache/archive/refs/heads/master.zipAlso on Packagist as valu/wp-graphql-cache:
composer require valu/wp-graphql-cacheFrom the readme
WARNING: This is an ALPHA release and not feature complete yet.
WPGraphQL Cache
Flexible caching framework for WPGraphQL v0.9.0 or later
Installation
composer require valu/wp-graphql-cache
Or you can clone it from Github to your plugins using the stable branch
cd wp-content/plugins
git clone --branch stable https://github.com/valu-digital/wp-graphql-cache.git
Query Caching
If you want to just start caching all your queries for a given period of time
you can just add this to your theme's functions.php or to a mu-plugin:
or you can target specific queries
Field Caching
Lets say you have a big query fetching various things where most of them are
reasonably fast but one of the is too slow. You can target that individual
root field with registergraphqlfieldcache().
This will start caching the menuItems root field on a GraphQL query named
MyBigQuery for 120 seconds.
Cache Control with Zones
You can clear all GraphQL caches with CacheManager::clear() but if you want
to be more specific with cache clearing you must pass in a zone property to
registergraphqlquerycache and registergraphqlfieldcache and you can
clear that zone with CacheManager::clearzone($zone).
Th
Read the full README on GitHub →