Skip to content
This repository has been archived by the owner on Nov 8, 2022. It is now read-only.

FOR DISCUSSION ONLY: rework caching #661

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

valette
Copy link

@valette valette commented Apr 26, 2020

load scripts using a fixed cache value defined as the compile time to solve caching issues. This PR only works with the following script added to index.html:

<script> window.GLOBALCOMPILETIME = ${compileTime}; </script>

load scripts using a fixed cache value defined as the compile time to solve caching issues. This PR only works with the following script added to index.html:
<script>
window.GLOBALCOMPILETIME = ${compileTime};
</script>
@cboulanger
Copy link
Contributor

Hi, can you describe in more detail what problem this PR is trying to solve? Maybe there is a different way that does not require to add additional code.

@valette
Copy link
Author

valette commented Apr 26, 2020

Hi,
this PR is for discussion only, I am facing issues with the caching mecanism on a server. Currently, there seems to have 2 ways of loading scripts with qooxdoo:

  • loading scripts without dealing with cache
  • loading scripts with cache busting i.e. adding ?nocache=Math.random()

but there is a third possible way : adding ?nocache=FIXEDVALUE where FIXEDVALUE would be defined at compile time.
With this approach, each new compilation would skip caching on the browser side, but once the script is loaded, a browser refresh would use the cached file as FIXEDVALUE did not change.

@valette
Copy link
Author

valette commented Apr 26, 2020

The patch is really dirty, I just wrote it to solve my problem quickly, and it would need more work if this approach was to be included in qooxdoo...

@valette
Copy link
Author

valette commented Apr 26, 2020

I forgot to add that the script loading part in index.html would become:

  ${preBootJs}
  <script type="text/javascript" src="${appPath}boot.js?nocache=${compileTime}"></script>

@valette valette changed the title FOR DISCUSSION ONLY: FOR DISCUSSION ONLY: rework caching Apr 26, 2020
@johnspackman
Copy link
Member

How about another solution - the scripts output into the boot.js file should have a timestamp which is the date that the file was last modified. This would only happen if addNoCacheParam is true, and would limit the cache-busting to the exact minimum required.

If you wanted to code it that would be really helpful!

I've noticed that the addNoCacheParam has not been implemented in the compiler, so there are a few steps:

@valette
Copy link
Author

valette commented Apr 27, 2020

Thank you for all the pointers, I will do that!

@hkollmann hkollmann added the do not merge do not merge the PR yet! label Apr 28, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
do not merge do not merge the PR yet!
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants