feat: add cache for blob query (#5178)

This commit is contained in:
DarkSky
2023-12-14 09:50:56 +00:00
parent 0c2d2f8d16
commit e9dfa93b52
4 changed files with 113 additions and 1 deletions

View File

@@ -33,6 +33,7 @@ import type {
import GraphQLUpload from 'graphql-upload/GraphQLUpload.mjs';
import { applyUpdate, Doc } from 'yjs';
import { MakeCache, PreventCache } from '../../cache';
import { EventEmitter } from '../../event';
import { PrismaService } from '../../prisma';
import { StorageProvide } from '../../storage';
@@ -656,6 +657,7 @@ export class WorkspaceResolver {
@Query(() => [String], {
description: 'List blobs of workspace',
})
@MakeCache(['blobs'], ['workspaceId'])
async listBlobs(
@CurrentUser() user: UserType,
@Args('workspaceId') workspaceId: string
@@ -690,6 +692,7 @@ export class WorkspaceResolver {
}
@Mutation(() => String)
@PreventCache(['blobs'], ['workspaceId'])
async setBlob(
@CurrentUser() user: UserType,
@Args('workspaceId') workspaceId: string,
@@ -749,6 +752,7 @@ export class WorkspaceResolver {
}
@Mutation(() => Boolean)
@PreventCache(['blobs'], ['workspaceId'])
async deleteBlob(
@CurrentUser() user: UserType,
@Args('workspaceId') workspaceId: string,