Add a cache on /metadata (#5189)

In this PR I'm introducing a simple custom graphql-yoga plugin to create
a caching mechanism specific to our metadata.

The cache key is made of : workspace id + workspace cache version, with
this the cache is automatically invalidated each time a change is made
on the workspace metadata.
This commit is contained in:
Lucas Bordeau
2024-04-26 17:31:40 +02:00
committed by GitHub
parent 8beec03762
commit 77eece77ea
4 changed files with 43 additions and 2 deletions

View File

@ -26,6 +26,7 @@ import { LoggerDriverType } from 'src/engine/integrations/logger/interfaces';
import { IsStrictlyLowerThan } from 'src/engine/integrations/environment/decorators/is-strictly-lower-than.decorator';
import { CaptchaDriverType } from 'src/engine/integrations/captcha/interfaces';
import { MessageQueueDriverType } from 'src/engine/integrations/message-queue/interfaces';
import { CacheStorageType } from 'src/engine/integrations/cache-storage/types/cache-storage-type.enum';
import { IsDuration } from './decorators/is-duration.decorator';
import { AwsRegion } from './interfaces/aws-region.interface';
@ -369,7 +370,7 @@ export class EnvironmentVariables {
@CastToPositiveNumber()
API_RATE_LIMITING_LIMIT = 500;
CACHE_STORAGE_TYPE = 'memory';
CACHE_STORAGE_TYPE: CacheStorageType = CacheStorageType.Memory;
@CastToPositiveNumber()
CACHE_STORAGE_TTL: number = 3600 * 24 * 7;