Closed valnub closed 8 years ago
I'm not sure, I will have to investigate.
Hi,
Just to say I have observed this behaviour today when using a cache config like so:
$http.defaults.cache = CacheFactory.createCache('offlineCache', {
deleteOnExpire: 'none',
maxAge: 10000,
storageMode: 'localStorage'
});
For me, switching deleteOnExpire
to passive
seems to resolve the issue (at least in my limited testing). However, it seems in this scenario that the cache entry will be served to $http
after expiry is reached (which is the behaviour I want, but it seems like none
was the correct option to use for that?).
angular-cache 4.4.3 angular 1.3.20 chrome 47.0.2526.106
I'm seeing the expires value set to null as well, but my configuration is using deleteOnExpire: 'passive'
.
CacheFactory.createCache('SocialManagerSelectorCache', {
maxAge: 3 * 60 * 60 * 1000, // 3 hours
deleteOnExpire: 'passive',
storageMode: 'localStorage'
});
Do any of you think this issue might be fixed by jmdobry/CacheFactory#8?
I tried a number of different parameter order configurations related to jmdobry/CacheFactory#8 and I still occasionally see a null expiry on all of them.
Also related, I believe #212 is being affected by this. When using localStorage and the expire value is null, this line will return true, triggering the clearing of the key in localStorage.
Should be working better now: https://plnkr.co/edit/Cc1xT8Ra3PWXQvl2J9zs?p=preview
:+1: Thanks!
Hi there, I am using angular-cache 4.4.3 like this:
Configuration
Get data:
As you can see I am using 15 min expire time, so after 15 mins I'd expect that angular-cache invalidates this cache entry and gets fresh data from the server. I noticed though that this sometimes does not work. After running my app for a while (especially after not using it for a day or so) I noticed that it won't get the fresh data from the server any more.
When I looked into the issue I saw that the "data" value in localStorage had an attribute called "expires". This is sometimes set to null. If this happens my app will never get fresh data from the server and is stuck at this point. I have to manually flush localStorage and then it starts working normally again with "expires" actually containing a timestamp value until it stops working again when this null value reappears out of nowhere.
So, my question is: How is it possible that expires is set to null with the configuration set above?