x-graphql/schema-cache

Caching GraphQL schema with PSR-16

0.1.1 2024-04-04 04:23 UTC

This package is auto-updated.

Last update: 2024-05-04 04:30:09 UTC


README

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