Socket
Socket
Sign inDemoInstall

@envelop/validation-cache

Package Overview
Dependencies
6
Maintainers
1
Versions
1527
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @envelop/validation-cache

This plugins adds simple LRU caching to your `validate`, to improve performance by caching the validation result.


Version published
Weekly downloads
173K
decreased by-4.67%
Maintainers
1
Install size
901 kB
Created
Weekly downloads
 

Readme

Source

@envelop/validation-cache

This plugins adds simple LRU caching to your validate, to improve performance by caching the validation result.

This plugins improves performance of validating by ~50% (based on benchmarks).

Getting Started

yarn add @envelop/validation-cache

Usage Example

import { execute, parse, specifiedRules, subscribe, validate } from 'graphql'
import { envelop, useEngine } from '@envelop/core'
import { useValidationCache } from '@envelop/validation-cache'

const getEnveloped = envelop({
  plugins: [
    useEngine({ parse, validate, specifiedRules, execute, subscribe }),
    // ... other plugins ...
    useValidationCache({
      // options goes here
    })
  ]
})

API Reference

cache

Set this to pass in a cache instance. By default a new LRU cache is created using default max and ttl.

FAQs

Last updated on 16 Oct 2023

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc