x-graphql/schema-cache

使用 PSR-16 缓存 GraphQL 模式

0.1.1 2024-04-04 04:23 UTC

This package is auto-updated.

Last update: 2024-09-04 05:54:25 UTC


README

从 PSR-16 缓存中保存和懒加载 GraphQL 模式

unit tests codecov

入门

通过 Composer 安装此包

composer require x-graphql/schema-cache symfony/cache

用法

使用 PSR-16 创建 XGraphQL\SchemaCache\SchemaCache 实例以保存和加载

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();

注意

此包在从缓存加载模式后不支持装饰类型,您需要在执行模式之前添加类型解析器。

致谢

Minh Vuong 创建