x-graphql / schema-cache
Caching GraphQL schema with PSR-16
Installs: 11 871
Dependents: 3
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 0
Open Issues: 0
Requires
- php: >=8.2
- psr/simple-cache: ^1.0 || ^2.0 || ^3.0
- webonyx/graphql-php: ^15.9
Requires (Dev)
- phpunit/phpunit: ^11.0
- symfony/cache: ^6.3 || ^7.0
- symplify/easy-coding-standard: ^12.1
README
Save and lazy load GraphQL Schema from PSR-16 cache.
Getting Started
Install this package via Composer
composer require x-graphql/schema-cache symfony/cache
Usages
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.
Credits
Created by Minh Vuong