Forum Discussion

steffenschoene's avatar
6 years ago

Old Cache & CDN Data after push to Production

Hi,

did anyone else have the same problem like us that the appcache and the files delivered by the CDN will not be refreshed on production after an push to production? If we changed some content in for example JavaScript files the changes are not be visible on production directly after an push to production.

We had included our JavaScript Files like this in the footer section of our community:

<script type="text/javascript" src="${asset.get('/html/assets/js/thc.global.min.js')}"></script>

 

We also tried this way but Khoros identified this restadmin call as an performance issue:

<#assign studioversion = restadmin("/plugins/live/version") />
<script type="text/javascript" src="${asset.get('/html/assets/js/thc.global.min.js')}?v=${studioversion.value}"></script>

 

Our current workaround, proposed by khoros is to create a new support case after every push to prod with JS file changes. Not very comfortable...

Did any one else run into the same problem? Is there maybe an other workaround which we currently not see?

Best regard,
Steffen

 

 

3 Replies

  • steffenschoene you might try to avoid the CDN entirely by not using asset.get()... Lithium won't like that too much, but if they can't get the CDN to properly clear after a publish, that might be your only way out without having to contact support each time.

    Furthermore, you can avoid your restadmin() call entirely and still get the version information of Lithium, check out the application context object of FreeMarker!

    In your specific case it might look something like this:

    <script type="text/javascript" src="/html/assets/js/thc.global.min.js?v=${application.version.revision}"></script>
  • Hi luk ,

    thanks, but the application.version.revision wasn't the solution for our problem. The application.version.revision is the Khoros release revision, not the studio version. The the number will not change after a push to production without a new Khoros Release.

    Any other ideas?

    Greetings
    Steffen

  • luk's avatar
    luk
    Boss
    6 years ago

    Hm, you could try to use the appcache (FreeMarker context object) to store the revision number from 

     

    restadmin("/plugins/live/version")

     

    that would avoid repetitive (and unnecessary) API requests to a certain degree.

    Another option could be to simply create a custom setting (you need support for that), add some kind of versioning-string in there and add that for cache-busting, something like this: 

     

    <script type="text/javascript" src="/html/assets/js/thc.global.min.js?v=${settings.name.get('version')}"></script>