My Library Docs

Multi-root Sidebar

flex-layout

  • Getting Started

  • Guides

  • Reference

typed-rx-http

  • Getting Started

  • Guides

  • Reference

global-rx-state

  • Getting Started

  • Guides

  • Reference

webflux-fe-dev-assistant

reactive-mongo-dsl

CSR Cache & Next.js

브라우저 cache는 Core의 createCsrCache로 사용하고, Next.js 서버 Data Cache가 필요할 때만 /next의 callApiSsrCache를 추가합니다.


cache wrapper도 commonService의 일부

이 페이지의 callApiClientCache/callApiServerCache 코드는 프로젝트 공용 HTTP adapter의 cache 부분만 떼어 설명합니다. generated service가 이 함수를 import하도록 구성할 수 있으므로, 전체 rxjsHttpService.ts/commonService.ts 구조를 먼저 보면 각 wrapper의 위치와 역할이 더 명확합니다.

CSR cache (클라이언트 cache)

createCsrCache<CacheName>()는 callApiCsrCache(callApiFn, serviceArgs, cacheOptions)와 removeCsrCache(cacheName)를 제공합니다.

ts

서버 환경에서는 CSR cache map을 만들지 않고 원래 callApi를 그대로 호출합니다. 브라우저에서는 같은 cache key의 Observable 결과를 shareReplay로 공유합니다.

사용자별 데이터는 cache하지 않기
브라우저/서버를 하나의 프로젝트 wrapper로 묶는 경우

공용 service에서 브라우저는 createCsrCache, 서버는 callApiSsrCache로 분기하도록 묶을 수도 있습니다. 이것은 프로젝트 구성 패턴이며 Core 자체의 필수 구조는 아닙니다.

commonService.ts
ts
commonService.ts
ts

자동 생성 service에서 cache wrapper를 사용할 때도 cache 기능이 필요한 endpoint에만 이 wrapper를 연결하고, 나머지는 일반 callApi를 그대로 사용합니다.

© 2026 Byeolnaerim. All rights reserved.소개개인정보처리방침