jmdobry / angular-cache

angular-cache is a very useful replacement for the Angular 1 $cacheFactory.
http://jmdobry.github.io/angular-cache
MIT License
1.39k stars 156 forks source link

TypeError: Cannot call method 'setOptions' of undefined #158

Closed andregeges closed 9 years ago

andregeges commented 9 years ago

Hi it is running well with browser view, but after i run on mobile device i got this error

TypeError: Cannot call method 'setOptions' of undefined

jmdobry commented 9 years ago

Make sure you check that the cache has been created before you do anything with it:

if (!DSCacheFactory.get('myCache')) {
  DSCacheFactory('myCache', { storageMode: 'localStorage', maxAge: 10000, deleteOnExpire: 'aggressive' });
}
DSCacheFactory.get('myCache').put('item', 'value');

Closing because I’m not sure this is an issue, if you are convinced that this is really a bug, please feel free to re-open the issue and add more information:

Otherwise support is done via the mailing list.