Remove caching completely

Hi. I have an app that reads the latest posts from my Wordpress website and displays it in a list. The problem is every time the user reopens the app it loads an old (cached) list of articles even though there are new posts on my website.

I’ve been through it all in terms of disabling caching in ionic.

  • I’ve set $ionicConfigProvider.views.maxCache(0);
  • My template’s first line is this: <ion-view class="home-view" cache-view="false">
  • Tried setting cache: false in .state('app.home')
  • Tried loading a state like this: $state.go('app.home', {}, {reload : true}); Did not work as expected.
  • Tried clearing the cache like this on resume: $ionicHistory.clearHistory(); $ionicHistory.clearCache();
  • Even tried stuff like $route.reload and $window.location.reload on resume but it’s not working.

None of them work. I’m at the end of my rope here!

Please help!

1 Like

How are you getting your data from your Wordpress site? Is it (effectively) from a static URL? Are you seeing this on iOS or Android? We’ve had some caching issues on iOS where we’ve updating an image but it’s not taken affect on iOS when the app is re-opened, but does on Android.

We’re using a JSON API plugin for Wordpress to retrieve the posts. And seeing this on Android. Building for Android only at the moment.

So no one can help? :frowning:

What I finally ended up doing was to load the pull to refresh’s function on beforeEnter like this:

$scope.$on("$ionicView.beforeEnter", function() {
    $scope.doRefresh();
  });

You never know, it might help someone else who finds themselves in the same situation as me :slight_smile:

2 Likes

That’s how I do it also but to me it looks like Ionic’s view caching is half baked being too much intrusive.

1 Like

Exactly. And I’m very much surprised there aren’t more posts than this on this topic.

1 Like