
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
@envelop/validation-cache
Advanced tools
This plugins adds simple LRU caching to your `validate`, to improve performance by caching the validation result.
@envelop/validation-cache is a plugin for GraphQL that provides caching for validation results. This can significantly improve the performance of GraphQL servers by avoiding redundant validation of the same queries.
Validation Caching
This feature allows you to cache the results of GraphQL query validations. By using the `useValidationCache` plugin, you can avoid re-validating the same queries, thus improving performance.
const { envelop } = require('@envelop/core');
const { useValidationCache } = require('@envelop/validation-cache');
const getEnveloped = envelop({
plugins: [
useValidationCache(),
],
});
graphql-query-complexity is a package that helps in limiting the complexity of GraphQL queries to prevent abuse. While it doesn't cache validation results, it provides a way to control the resource usage of queries, which can complement the functionality of @envelop/validation-cache.
graphql-cost-analysis is another package that helps in analyzing and limiting the cost of GraphQL queries. It focuses on preventing expensive queries from being executed, which can be used alongside @envelop/validation-cache to ensure both performance and security.
graphql-depth-limit is a package that restricts the depth of GraphQL queries to prevent overly complex queries. This can be used in conjunction with @envelop/validation-cache to ensure that only queries of acceptable complexity are cached and executed.
@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).
yarn add @envelop/validation-cache
import { envelop } from '@envelop/core'
import { useValidationCache } from '@envelop/validation-cache'
const getEnveloped = envelop({
plugins: [
// ... other plugins ...
useValidationCache({
// options goes here
})
]
})
cache
Set this to pass in a cache instance. By default a new LRU cache is created using default max
and ttl
.
FAQs
This plugins adds simple LRU caching to your `validate`, to improve performance by caching the validation result.
The npm package @envelop/validation-cache receives a total of 127,235 weekly downloads. As such, @envelop/validation-cache popularity was classified as popular.
We found that @envelop/validation-cache demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
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.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.