Old copy of template is running - how do I clear the cache?



  • I see this in the debug log: "Taking compiled template from engine cache"

    And I also see some stuff sent to the console that is now commented out. I think an old version of the template is being rendered. How do I clear the cache or force a rebuild of the cache?


  • administrators

    I think an old version of the template is being rendered. How do I clear the cache or force a rebuild of the cache?>

    the cache key used for storing the compiled template is the template content + the engine used, so any time you change the content or the engine is changed the render won't use the previous compiled cache.

    you can disable the cache at all by using this in your configuration file:

    {
      "templatingEngines": {
        "templateCache": { "enabled": false }
      }
    }
    

    i have to say that the cache should work fine, i don't think it should be taking old template if you have changed the content of template, but if you have some steps to reproduce that we will more than happy to fix it (if the bug exists)



  • And, I'm an idiot again. Turned out the log messages I thought were coming from the main script were coming from a handlebars helper. Duh. I shouldn't have put the same thing in two places.



  • Hi , can you tell me. where i found this cache folder ?


  • administrators

    @anku9896 the template cache is not persisted, it is just some in-memory values that exist during the lifetime of the process, so if you restart the process, the cache starts from 0 items again



  • Hi thanks for the reply, yes this is the problem , @bjrmatos . i want to restart the server always. Is any way to stop this, no need to restart server.


  • administrators

    @anku9896 sorry, i don't understand what you want specifically, what do you want to stop? if you are asking for a way to reset the cache without restarting the server then this is not possible, in that case, it is probably better to just disable the cache entirely with the configuration mentioned above


Log in to reply
 

Looks like your connection to jsreport forum was lost, please wait while we try to reconnect.