Angular Cache error: typeError: Cannot call method 'get' of undefined angular cache

Hi there,
Im not so sure if its the right place to post this but m getting the following error when trying to fetch cached data:
TypeError: Cannot call method ‘get’ of undefined angular cache

Everything seems to be fine in Chrome but in both emulators, Genymotion and android, I’m getting the above error.
Ive set the initial call in the app.js like this:
DSCacheFactory(“generalDataCache”, {storageMode:“localStorage”,maxAge: 10000, deleteOnExpire: “aggressive”});
and in my service:
self.generalCache = DSCacheFactory.get(“generalDataCache”);
and getting the exception on the following get method:

Any idea?

Ok so all I needed to do is to check if the object is defined else recreate it.!!

I also get this error randomly - I eventually wrapped it in a Try/catch block and reset it if it fails… felt a bit hacky

All you need to do is the following:

     if (!DSCacheFactory.get("yourcachekey")) {
       DSCacheFactory("yourcachekey", {storageMode:"localStorage",maxAge: 10000, deleteOnExpire: "aggressive"});
  self.myCache = DSCacheFactory.get("yourcachekey");

You do not need to initial it in the app.js. Instead you can make the above condition in your controller/service.
Hope it helps.

Thanks… I noticed that it has changed a fair bit in the latest version :

Looks like it is simpler to work with (and has some breaking changes) - I will upgrade and try their new way and report back here