<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Caching Fetch API response to prevent unnecessary multiple calls in Integration and Testing</title>
    <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/Caching-Fetch-API-response-to-prevent-unnecessary-multiple-calls/m-p/70464#M43272</link>
    <description>&lt;P class="_1qeIAgB0cPwnLhDF9XSiJM"&gt;So I'm using Fetch API for my mobile PWA, which is basically just written in HTML and JQuery/JS.&lt;/P&gt;&lt;P class="_1qeIAgB0cPwnLhDF9XSiJM"&gt;Basically if you click on a tab for the first time, I want it to load the response HTML (easy).&lt;/P&gt;&lt;P class="_1qeIAgB0cPwnLhDF9XSiJM"&gt;However, if you click away and click back to it, I don't want it to reload the response HTML just yet.&lt;/P&gt;&lt;P class="_1qeIAgB0cPwnLhDF9XSiJM"&gt;I want it to simply display the response HTML from the first instance of loading.&lt;/P&gt;&lt;P class="_1qeIAgB0cPwnLhDF9XSiJM"&gt;Fetch API doesn't allow me to tweak how long I can cache the response; the best is only 'force-cache' which is a forever cache, which is not what I want. So I'm thinking of "hacking" it to simulate a fake cache, meaning just place the response HTML into a div using the JQuery on first loading, setTimeout() for 15 minutes or whatever (after which it empties the div), and each time the link is clicked, I check within the div first to see if it's populated. If yes, just show the div itself. If no, reload the link using Fetch.&lt;/P&gt;</description>
    <pubDate>Mon, 27 Jan 2020 09:52:52 GMT</pubDate>
    <dc:creator>DominicLandon</dc:creator>
    <dc:date>2020-01-27T09:52:52Z</dc:date>
    <item>
      <title>Caching Fetch API response to prevent unnecessary multiple calls</title>
      <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/Caching-Fetch-API-response-to-prevent-unnecessary-multiple-calls/m-p/70464#M43272</link>
      <description>&lt;P class="_1qeIAgB0cPwnLhDF9XSiJM"&gt;So I'm using Fetch API for my mobile PWA, which is basically just written in HTML and JQuery/JS.&lt;/P&gt;&lt;P class="_1qeIAgB0cPwnLhDF9XSiJM"&gt;Basically if you click on a tab for the first time, I want it to load the response HTML (easy).&lt;/P&gt;&lt;P class="_1qeIAgB0cPwnLhDF9XSiJM"&gt;However, if you click away and click back to it, I don't want it to reload the response HTML just yet.&lt;/P&gt;&lt;P class="_1qeIAgB0cPwnLhDF9XSiJM"&gt;I want it to simply display the response HTML from the first instance of loading.&lt;/P&gt;&lt;P class="_1qeIAgB0cPwnLhDF9XSiJM"&gt;Fetch API doesn't allow me to tweak how long I can cache the response; the best is only 'force-cache' which is a forever cache, which is not what I want. So I'm thinking of "hacking" it to simulate a fake cache, meaning just place the response HTML into a div using the JQuery on first loading, setTimeout() for 15 minutes or whatever (after which it empties the div), and each time the link is clicked, I check within the div first to see if it's populated. If yes, just show the div itself. If no, reload the link using Fetch.&lt;/P&gt;</description>
      <pubDate>Mon, 27 Jan 2020 09:52:52 GMT</pubDate>
      <guid>https://community.developer.cybersource.com/t5/Integration-and-Testing/Caching-Fetch-API-response-to-prevent-unnecessary-multiple-calls/m-p/70464#M43272</guid>
      <dc:creator>DominicLandon</dc:creator>
      <dc:date>2020-01-27T09:52:52Z</dc:date>
    </item>
  </channel>
</rss>

