@envelop/validation-cache 4.4.0-alpha-26c4ae2.0 → 4.4.0-alpha-8a8cd36.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 +33 -0
- package/package.json +2 -2
package/README.md
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
## `@envelop/validation-cache`
|
|
2
|
+
|
|
3
|
+
This plugins adds simple LRU caching to your `validate`, to improve performance by caching the validation result.
|
|
4
|
+
|
|
5
|
+
This plugins improves performance of validating by ~50% (based on benchmarks).
|
|
6
|
+
|
|
7
|
+
## Getting Started
|
|
8
|
+
|
|
9
|
+
```
|
|
10
|
+
yarn add @envelop/validation-cache
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Usage Example
|
|
14
|
+
|
|
15
|
+
```ts
|
|
16
|
+
import { envelop } from '@envelop/core';
|
|
17
|
+
import { useValidationCache } from '@envelop/validation-cache';
|
|
18
|
+
|
|
19
|
+
const getEnveloped = envelop({
|
|
20
|
+
plugins: [
|
|
21
|
+
// ... other plugins ...
|
|
22
|
+
useValidationCache({
|
|
23
|
+
// options goes here
|
|
24
|
+
}),
|
|
25
|
+
],
|
|
26
|
+
});
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
### API Reference
|
|
30
|
+
|
|
31
|
+
#### `cache`
|
|
32
|
+
|
|
33
|
+
Set this to pass in a cache instance. 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/validation-cache",
|
|
3
|
-
"version": "4.4.0-alpha-
|
|
3
|
+
"version": "4.4.0-alpha-8a8cd36.0",
|
|
4
4
|
"sideEffects": false,
|
|
5
5
|
"peerDependencies": {
|
|
6
|
-
"@envelop/core": "2.4.0-alpha-
|
|
6
|
+
"@envelop/core": "2.4.0-alpha-8a8cd36.0",
|
|
7
7
|
"graphql": "^14.0.0 || ^15.0.0 || ^16.0.0"
|
|
8
8
|
},
|
|
9
9
|
"dependencies": {
|