To configure the angular-cache, follow this setup:
app.service('myService', function ($angularCacheFactory) {
// This cache will synchronize with localStorage if available. Upon each app load, it will attempt to retrieve any previously saved data from localStorage (or sessionStorage).
var myAwesomeCache = $angularCacheFactory('myAwesomeCache', {
maxAge: 900000, // Items in this cache expire after 15 minutes.
cacheFlushInterval: 3600000, // The cache will clear itself every hour.
deleteOnExpire: 'aggressive', // Items will be immediately removed upon expiration.
storageMode: 'localStorage' // The cache syncs with `localStorage`.
});
});
If the storageMode is set to 'localStorage', then the caching system manages backing up to localstorage on its own.
I am currently using the angular LocalStorageModule for other purposes.
Would there be any benefit in setting up a localStoragePolyfill and utilizing the LocalStorageModule as well?