미들
2026년 11월 18일버그를 찾아라: Node.js / NestJS
코드 한 조각. 버그를 찾거나, 버그가 없음을 증명하세요.
typescript
1@Injectable()
2export class ArticleService {
3 constructor(
4 private redis: Redis,
5 private prisma: PrismaService,
6 ) {}
7
8 async getArticleById(id: string): Promise<Article | null> {
9 const cacheKey = `article:${id}`;
10 const cached = await this.redis.get(cacheKey);
11 if (cached) return JSON.parse(cached);
12 const article = await this.prisma.article.findUnique({ where: { id } });
13 if (!article) return null;
14 await this.redis.set(cacheKey, JSON.stringify(article), 'EX', 600);
15 return article;
16 }
17}문제가 되는 줄을 클릭하세요.
당신의 판단
하루 한 번. 제출하면 바로 정답이 표시됩니다.
연속 기록 유지하기
계정을 만들면 연속 기록을 유지하고 진행 상황을 추적할 수 있습니다.