Save and lazy load GraphQL Schema from PSR-16 cache.
Install this package via Composer
composer require x-graphql/schema-cache symfony/cache
Create an instance of XGraphQL\SchemaCache\SchemaCache
with PSR-16 to save and load:
use Symfony\Component\Cache\Adapter\ArrayAdapter;
use Symfony\Component\Cache\Psr16Cache;
use XGraphQL\SchemaCache\SchemaCache;
$psr16 = new Psr16Cache(new ArrayAdapter());
$schemaCache = new SchemaCache($psr16);
$schemaCache->save(/* $schema */);
/// Lazy to load on another http requests
$schemaFromCache = $schemaCache->load();
Note
This package not support to decorate type after load schema from cache, you need to add type resolvers before execute schema.
Created by Minh Vuong