2016-12-19 2 views
0

/products.json을 요청하여 X 개의 제품이있는 JSON 배열을 반환한다고 가정 해 봅니다. 각 번호는 /product/[id].json입니다. siesta가 각 제품에 대한 요청 대신 정보를 캐시 할 수 있습니까? 또는 모델을 리소스와 별도로 캐시해야합니까?단일 요청에서 여러 리소스 캐시

답변

0

여기에 대한 간단한 설명이있다 : 낮잠은 현재 존재

https://github.com/bustoutsolutions/siesta/issues/156

, 각 URL이 별도의 캐시 된 상태로 별도의 자원이다. 그러나 수동으로 개별 결과를 해당 자원에 대한 인덱스 /리스트/검색 자원의 변경 사항을 전파 할 수 있습니다 :

childResource.addObserver(self) 
parentResource.addObserver(owner: self) { 
    if case .newData = $1 { 
    childResource.invalidate() 
    // Delayed refresh prevents redundant load if multiple 
    // children trigger a refresh on the same parent 
    DispatchQueue.main.async { 
     childResource.loadIfNeeded() 
    } 
    } 
} 

를 그보다 배경이 Github에서 문제 토론.

관련 문제