Skip to content

Commit 67f5e50

Browse files
docs: add README
1 parent 0addaba commit 67f5e50

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed

README.md

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
Schema Cache
2+
============
3+
4+
Save and lazy load [GraphQL Schema](https://webonyx.github.io/graphql-php/schema-definition/) from PSR-16 cache.
5+
6+
![unit tests](https://github.com/x-graphql/schema-cache/actions/workflows/unit_tests.yml/badge.svg)
7+
[![codecov](https://codecov.io/gh/x-graphql/schema-cache/graph/badge.svg?token=c1xCJsFvIs)](https://codecov.io/gh/x-graphql/schema-cache)
8+
9+
10+
Getting Started
11+
---------------
12+
13+
Install this package via [Composer](https://getcomposer.org)
14+
15+
```shell
16+
composer require x-graphql/schema-cache symfony/cache
17+
```
18+
19+
Usages
20+
------
21+
22+
Create an instance of `XGraphQL\SchemaCache\SchemaCache` with PSR-16 to save and load:
23+
24+
```php
25+
use Symfony\Component\Cache\Adapter\ArrayAdapter;
26+
use Symfony\Component\Cache\Psr16Cache;
27+
use XGraphQL\SchemaCache\SchemaCache;
28+
29+
$psr16 = new Psr16Cache(new ArrayAdapter());
30+
$schemaCache = new SchemaCache($psr16);
31+
32+
$schemaCache->save(/* $schema */);
33+
34+
/// Lazy to load on another http requests
35+
36+
$schemaFromCache = $schemaCache->load();
37+
```
38+
> [!NOTE]
39+
> This package not support to decorate type after load schema from cache,
40+
> you need to add type resolvers before execute schema.
41+
42+
Credits
43+
-------
44+
45+
Created by [Minh Vuong](https://github.com/vuongxuongminh)

0 commit comments

Comments
 (0)