Navigation

    APPDRAG Community

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Popular

    REMINDER

    Please be respectful of all AppDragers! Keep it really civil so that we can make the AppDrag community of builders as embracing, positive and inspiring as possible.

    SOLVED Cache isn't working?

    Cloud Backend (Cloud DB, API Builder)
    4
    15
    1336
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • T
      Thomas D @Wassim last edited by

      @wassim

      Just tried with a blank page, same issue, cache only lasts a few seconds...

      1 Reply Last reply Reply Quote 0
      • J
        jbenguira last edited by

        Hey Thomas,
        You have not disclosed the url so I can't check...

        T 1 Reply Last reply Reply Quote 0
        • T
          Thomas D @jbenguira last edited by

          @jbenguira I've sent them in a PM

          Joseph Benguira 1 Reply Last reply Reply Quote 0
          • Joseph Benguira
            Joseph Benguira @Thomas D last edited by Joseph Benguira

            @thomasd OK I checked your url and PM
            in fact caching affect only resources, not the HTML pages ...
            in our setup .html files are always returned with this header

            cache-control: public, must-revalidate, max-age=0
            

            but it will still be cached for a maximum of 30 seconds

            FYI from a cloud function (in gateway mode) you can set any http header
            including something like this
            cache-control: max-age=14400

            Since you use Cloudflare, another option is to activate caching from there
            you can do that with a "Page Rule"

            T 1 Reply Last reply Reply Quote 1
            • T
              Thomas D @Joseph Benguira last edited by Thomas D

              @joseph-benguira

              I've tried using Cloudflares pagerule "Cache everything" - but since the headers invalidate cache, Cloudflare will do the same and set pages to "Dynamic" mode.

              From cloudflare:
              "Whether we actually store the asset and for how long is determined by the Cache-Control headers returned with responses from the origin server"

              Using Edge Cache TTL makes it possible, but that disables all cookies....

              This means the potential API requests for this site with 400 products and 2x languages would be 2.3M requests in 24 hours....

              Can you please change the admin text for cache duration, it's very missleading if it's only for assets and not content (as the text says).

              1 Reply Last reply Reply Quote 0
              • Joseph Benguira
                Joseph Benguira last edited by Joseph Benguira

                Hey @ThomasD , we fixed yesterday an issue with this cache option, this has bee published in production last night.

                I can now see your cache duration correctly applied 🙂

                Could you check again and confirm it's now all good?

                T 2 Replies Last reply Reply Quote 1
                • T
                  Thomas D @Joseph Benguira last edited by

                  @joseph-benguira

                  Thanks! It's now working as I expected it to, at rocket speed 🙂 🚀

                  1 Reply Last reply Reply Quote 1
                  • T
                    Thomas D @Joseph Benguira last edited by Thomas D

                    @joseph-benguira
                    Is Cache on a per-session basis?

                    If I reload until I have "Hit from cloudfront" and then change to another browser, I'll get a "Miss from cloudfront".

                    Shouldn't the other browser get the Cache hit as well?

                    J 1 Reply Last reply Reply Quote 0
                    • J
                      jbenguira @Thomas D last edited by

                      @thomasd no it's not based on sessions but based on headers, so different browsers will pass different user agent and so are cached differently

                      T 1 Reply Last reply Reply Quote 0
                      • T
                        Thomas D @jbenguira last edited by

                        @jbenguira

                        So, every new unique visitor will be served a fresh page-view, right?

                        J 1 Reply Last reply Reply Quote 0
                        • J
                          jbenguira @Thomas D last edited by jbenguira

                          @thomasd nop, not all headers are making the cache vary, and most users will use chrome, safari or Firefox

                          1 Reply Last reply Reply Quote 0
                          • First post
                            Last post