Skip to content

Commit

Permalink
docs: add README
Browse files Browse the repository at this point in the history
  • Loading branch information
vuongxuongminh committed Apr 1, 2024
1 parent 0addaba commit 67f5e50
Showing 1 changed file with 45 additions and 0 deletions.
45 changes: 45 additions & 0 deletions README.md
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)

0 comments on commit 67f5e50

Please sign in to comment.