각도 캐시는 다음과 같이 설정할 수 있습니다 다음 storageMode가 '로컬 스토리지'로 설정되어 있으면 내가 이해에서각도 캐시를 사용할 때 Angular LocalStorageModule을 사용하면 어떤 이점이 있습니까?
app.service('myService', function ($angularCacheFactory) {
// This cache will sync itself with localStorage if it exists, otherwise it won't. Every time the
// browser loads this app, this cache will attempt to initialize itself with any data it had
// already saved to localStorage (or sessionStorage if you used that).
var myAwesomeCache = $angularCacheFactory('myAwesomeCache', {
maxAge: 900000, // Items added to this cache expire after 15 minutes.
cacheFlushInterval: 3600000, // This cache will clear itself every hour.
deleteOnExpire: 'aggressive', // Items will be deleted from this cache right when they expire.
storageMode: 'localStorage' // This cache will sync itself with `localStorage`.
});
});
다음 그 자체를 로컬 스토리지에 백업을 처리합니다.
다른 것들을 위해 이미 각 LocalStorageModule을 사용하고 있습니다.
localStoragePolyfill을 설정하고 LocalStorageModule을 사용하면 어떤 이점이 있습니까?
아마도 내 질문에 대해 혼란스러워합니다. 또는 아마도 나는 당신의 대답과 혼동스러워합니다. 나는 이미 "storageMode : 'localStorage'"를 사용하고 있습니다. Angular LocalStorageModule을 사용할 때 이점이 있다면 제가 알고 싶은 것은 무엇입니까? 각도 캐시가 필요한 모든 것을 수행하는 것처럼 응용 프로그램에서 삭제할 수 있습니까? – Melina
@Melina 흠, 여기서 저는 로컬 스토리지 (캐시가없는)의 다른 사용법을 설명하려했습니다. http://stackoverflow.com/a/21229481/1679310. 다른 말로 표현하자면,이 개념이 다르다는 것입니다. 그들은 함께 살 수 있지만 다르게 사용합니다. 정적 데이터 (예 : 메타 데이터 또는 템플릿, 또는 가장 중요한 것은 ** 사용자 정의 설정 **)는 매번 다시로드 할 필요가 없습니다. 다음 번에 사용할 준비가되어 있어야합니다. 그러면 로컬 스토리지가 우선합니다. 동적 데이터는 오직 캐싱 될 수 있지만 ... –
"내장 된 핸들러를 사용하여 {storageMode : 'localStorage'}처럼 전달할 수 있습니다. 이제 다음과 같이해야합니다. https://github.com/ greyory/angular-local-storage 또는 각도 캐시로 필요한 모든 것을 할 수 있습니까? – Melina