Time based caching

I have gone through the documentation on cached views in Beta 14. However I cannot see any config to specify how long the view should be cached for.

I would like to keep the cached views for 10 minutes. After that time, the view should be removed and a fresh view loaded if the user accesses this view.

Is there anything I am missing here? If the core product doesnt provide that functionality, what way would you recommend to achieve it?

I assume one way would be to check when was the currently being accessed view created (if its possible?) and then remove the view if its older than a given timespan. I would prefer however to stick to the core functionality if possible.

Thanks

1 Like

Nobody knows the solution?

maybe you could try setting an interval in your main ctrl like this:

$interval(function(){
   $ionicHistory.clearCache();
},600000);

Looking at the source code of history.js (line 631 and further) you can pass in options for the cache expire time for the next view:

$ionicHistory.nextViewOptions({
    expire: 60*60*2 // 2 hours
});

I don’t know if it is possible to set any global expire time, but therefore you should checkout history.js more.