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.


The full quick win with snippets is only available to Ionic Academy members.
Join now for

  • Unlimited access to all quick wins
  • Library of 40+ step-by-step video courses
  • Support for Ionic questions via Slack & private community

Join now & Unlock

Current member? LOGIN


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 *