Options
All
  • Public
  • Public/Protected
  • All
Menu

SSR 캐시 설정 정보

Hierarchy

  • SsrCacheConfiguration

Index

Properties

Optional enabled

enabled: boolean

캐시 활성화 여부

Optional isCacheable

isCacheable: (path: string, context: Context) => boolean

캐시 적용 여부 판단 function (설정되어 있다면 pages보다 우선하여 설정)

Type declaration

    • (path: string, context: Context): boolean
    • Parameters

      • path: string
      • context: Context

      Returns boolean

Optional key

key: (route: Route, context: Context) => string

캐시 키 반환 function

Type declaration

    • (route: Route, context: Context): string
    • Parameters

      • route: Route
      • context: Context

      Returns string

Optional pages

pages: string[] | RegExp[]

캐시에 담을 페이지 URL 목록

 '/'  // 모든 페이지 캐시 사용
 '/page1', '/page2' // 특정 페이지
 /^\/page3\/\d+$/ // page3로 시작되는 페이지
 /^\/$/ // only root 페이지

Optional store

store 설정

// 메모리 store
{
 type: 'memory',
 max: 100, // 캐시 최대 갯수
 ttl: 60   // 캐시 유지 시간(초)
}

// REDIS
// @see https://www.npmjs.com/package/cache-manager-redis
{
 type: 'redis',
 host: 'localhost',
 ttl: 60,
 // redis 구동 설정
 configure: [
   ['maxmemory', '200mb'],
   ['maxmemory-policy', 'allkeys-lru'],
 ]
}

// memcached
// @see https://www.npmjs.com/package/cache-manager-memcached-store
{
 type: 'memcached',
 options: {
   hosts: ['127.0.0.1:11211'],
 }
}

// multi
{
 type: 'multi',
 stores: [
   { type: 'memory', //... },
   { type: 'redis', //... },
 ]
}

Optional useHostPrefix

useHostPrefix: boolean

호스트별로 prefix를 분리할지 여부