Flushing all cached views programatically?

I have been using the cached views in Beta 14 with much success, and loving the performance improvement because of them.

However, I have a situation whereby my user can log out of my app and then log back in as another user.

In those cases, I would understandably like to flush all the cached views currently in memory so that caching can begin afresh when the new user starts using the app.

At present, when the new user logs in, the old cached views are still there, so they can see data pertaining to the old user, not themselves, until the app is completely shut down and restarted.

Is this possible to do?

You can use $ionicHistory.clearCache() to clear all cached view.
More info on

http://ionicframework.com/docs/api/service/$ionicHistory/

2 Likes

Excellent! That was exactly what I was looking for - thank you very much @kamleshkoringa !!