Download the PHP package valu/wp-graphql-cache without Composer

On this page you can find all versions of the php package valu/wp-graphql-cache. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package wp-graphql-cache

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 register_graphql_field_cache().

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 register_graphql_query_cache and register_graphql_field_cache and you can clear that zone with CacheManager::clear_zone($zone).

The zone is a caching zone the cache will be stored to. Zones are needed because the cached responses are written to multiple cache keys because graphql variables and the current user can change between calls to the same query

The zone can be cleared with CacheManager::clear_zone()

You can also share the same zone between multiple caches.

WP CLI

The zones can be cleared using the WP CLI too

Measuring Performance

WPGraphQL Cache comes with very simple build query performance tool which adds a x-graphql-duration header to the /graphql responses. It contains the duration of the actual GraphQL response resolving in milliseconds. When no caches are hit this is the theoretical maximun this plugin can take of from the response times. Everything else is spend in setting up WP and WPGraphQL itself before the GraphQL resolver execution.

If you want to go beyond that you can enable GET requests with Persisted Queries in the WPGraphQL Lock plugin and cache the whole response in your edge server (nginx, varnish, CDN etc.). This will be the absolute best performing cache because the PHP interpreter is not invoked at all on cache hit.

Storage Backends

There are couple storage backends availables which can be configured using the graphql_cache_backend filter.

FileSystem

This is the default backend which writes the cache to /tmp/wp-graphql-cache. It not super fast but it can perform reasonably when backed by a RAM disk.

Transient

This is cache storage backend which writes WordPress transients.

This is a flexible cache storage backend as the true storage can be configured at a platform level via the use of the object cache. By default if no object cache is defined WordPress will store transients as options in the database.

For example a single server environment might use a APC object cache where as a HA environment might have a Memcached or Redis backend.

OPCache

TODO

Custom Backends

A custom backend can be also returned as long as it extends from \WPGraphQL\Extensions\Cache\Backend\AbstractBackend.


All versions of wp-graphql-cache with dependencies

PHP Build Version
Package Version
No informations.
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package valu/wp-graphql-cache contains the following files

Loading the files please wait ....