@envelop/parser-cache 4.4.0-alpha-26c4ae2.0 → 4.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +37 -0
- package/package.json +2 -2
package/README.md
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
## `@envelop/parser-cache`
|
|
2
|
+
|
|
3
|
+
This plugins adds simple LRU caching to your `parse`, to improve performance by caching the parsed result.
|
|
4
|
+
|
|
5
|
+
This plugins improves performance of parsing by ~60% (based on benchmarks).
|
|
6
|
+
|
|
7
|
+
## Getting Started
|
|
8
|
+
|
|
9
|
+
```
|
|
10
|
+
yarn add @envelop/parser-cache
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Usage Example
|
|
14
|
+
|
|
15
|
+
```ts
|
|
16
|
+
import { envelop } from '@envelop/core';
|
|
17
|
+
import { useParserCache } from '@envelop/parser-cache';
|
|
18
|
+
|
|
19
|
+
const getEnveloped = envelop({
|
|
20
|
+
plugins: [
|
|
21
|
+
// ... other plugins ...
|
|
22
|
+
useParserCache({
|
|
23
|
+
// options goes here
|
|
24
|
+
}),
|
|
25
|
+
],
|
|
26
|
+
});
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
### API Reference
|
|
30
|
+
|
|
31
|
+
#### `documentCache`
|
|
32
|
+
|
|
33
|
+
Set this to pass in a cache instance for caching documents. By default a new LRU cache is created using default `max` and `ttl`.
|
|
34
|
+
|
|
35
|
+
#### `errorCache`
|
|
36
|
+
|
|
37
|
+
Set this to pass in a cache instance for caching errors. By default a new LRU cache is created using default `max` and `ttl`.
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@envelop/parser-cache",
|
|
3
|
-
"version": "4.4.0
|
|
3
|
+
"version": "4.4.0",
|
|
4
4
|
"sideEffects": false,
|
|
5
5
|
"peerDependencies": {
|
|
6
|
-
"@envelop/core": "2.4.0
|
|
6
|
+
"@envelop/core": "^2.4.0",
|
|
7
7
|
"graphql": "^14.0.0 || ^15.0.0 || ^16.0.0"
|
|
8
8
|
},
|
|
9
9
|
"dependencies": {
|