-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0addaba
commit 67f5e50
Showing
1 changed file
with
45 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
Schema Cache | ||
============ | ||
|
||
Save and lazy load [GraphQL Schema](https://webonyx.github.io/graphql-php/schema-definition/) from PSR-16 cache. | ||
|
||
![unit tests](https://github.com/x-graphql/schema-cache/actions/workflows/unit_tests.yml/badge.svg) | ||
[![codecov](https://codecov.io/gh/x-graphql/schema-cache/graph/badge.svg?token=c1xCJsFvIs)](https://codecov.io/gh/x-graphql/schema-cache) | ||
|
||
|
||
Getting Started | ||
--------------- | ||
|
||
Install this package via [Composer](https://getcomposer.org) | ||
|
||
```shell | ||
composer require x-graphql/schema-cache symfony/cache | ||
``` | ||
|
||
Usages | ||
------ | ||
|
||
Create an instance of `XGraphQL\SchemaCache\SchemaCache` with PSR-16 to save and load: | ||
|
||
```php | ||
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](https://github.com/vuongxuongminh) |