Skip to content

x-graphql/schema-cache

Repository files navigation

Schema Cache

Save and lazy load GraphQL Schema from PSR-16 cache.

unit tests codecov

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

About

Caching GraphQL schema with PSR-16

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published

Languages