Ionic Caching Service [v3]

ionic-caching-header

By default your Ionic app comes without specific HTTP caching, but sometimes it can really make sense to cache your requests for a duration to make help save the data volume of your users.

In this Quick Win we will add a super cool plugin called Ionic Cache (I think it’s no official plugin yet) to our Ionic app and perform some requests to the public Star Wars API.


ionic-academy-start

You must be a Member to view this Quick Win

Access all courses and lessons, track your progress, connect with Developers & build awesome Ionic Apps.


Comments on Ionic Caching Service [v3]

  1. My Jio says:

    can i use this plugin to cache image/videos

  2. Himalaya Ahuja says:

    Is there any github page for this project for further benefit? thanks for the great info though.. 🙂

  3. Jay says:

    Do you have any recommendations for showing a loader when the page is initially loaded as I currently see a blank page until its loaded.

    I do have it “working” but its not the best way so any help will be much appreciated.

    1. Shohrat Beknazarov says:

      this.cache.getItem(this.catss)
      .then((err) => {

      let ttl = 180;
      this.cats4 = this.cache.loadFromObservable(this.catss, req, this.catss, ttl);

      }).catch((err) => {

      let loading = this.loadingController.create({spinner: ‘dots’,cssClass: ‘loadcss’,showBackdrop: false});
      loading.present().then(() => {

      let delayType = ‘all’;
      let ttl = 60 * 60 * 12;
      this.cats4 = this.cache.loadFromDelayedObservable(this.catss, req, this.catss, ttl, delayType);

      loading.dismissAll();

      });

    2. bruno says:

      You could use the loading controller and present the loading spinner before making your request and then dismiss it after the observable completes.

Leave a Reply

Your email address will not be published. Required fields are marked *