x-graphql / schema-cache
使用 PSR-16 缓存 GraphQL 模式
0.1.1
2024-04-04 04:23 UTC
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
从 PSR-16 缓存中保存和懒加载 GraphQL 模式。
入门
通过 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 创建