I want to disable cache for a specific file which I am loading with a layout file. Is this possible?

I tried it like this, because I saw it like this somewhere:

<reference name="head">
    <action method="addJs">
        <script>konfigurator/konfigurator.js</script>
        <lifetime>null</lifetime>
    </action>
</reference>

But it does not work? Is it even possible?

<reference name="block.name">
    <action method="unsetData"><key>cache_lifetime</key></action>
    <action method="unsetData"><key>cache_tags</key></action>
    <action method="setCacheLifetime"><s>0</s></action>
</reference>
  • How does this work in my case? – Black Oct 12 at 20:36
  • What do you exactly want to do , disable a js cache via layout ? if yes why ? – PRINCE Oct 12 at 20:44
  • yes. Because I am developing a javascript file and I always have to wait 2 minutes before I can see the changes. – Black Oct 13 at 12:58

I think it's use full to you

<block class="Block\Class" name="blockname" cacheable="false" />
  • But I have no block, I just want to add a JavaScript file. – Black Oct 12 at 12:13
  • This is a M2 code – PRINCE Oct 12 at 14:50

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.