Nodonisko/ionic-cache

Error: Cache entry already expired: image

PeterHdd opened this issue · 1 comments

After calling getItem("image"), I get the following error:

Error: Cache entry already expired: image

How can I prevent it from expiring? If I increase the setDefaultTTL will the image no expire anymore?

Let say I do cache.setDefaultTTL(600 * 600);.

Also if this is not possible, can I check if an image is expired or not to prevent this error?

I think you can use catch/catchError operator to catch error.

TTL means time to live, so if you will use 600*600 your entry will expire in about 4 days. If you want your entries to do not expire you can do something like this:

cache.setDefaultTTL(Number.MAX_SAFE_INTEGER)

You can also use method for getting raw entries cache.getRawItem