New Function inspectTemplates() in 5.3.6

inspectTemplates() let you flag all file compiled code the in the cache to be checked Once (Good) again, useful when you have Inspect templates set to Never (Best Performance).

The result is that only the changed files are re-compiled, all the others remain cached. Date checking occurs as the files are loaded, as does recompilation

Good for including in your application init/reload sections.

https://luceeserver.atlassian.net/browse/LDEV-2774

This is the smart version of pagePoolClear(), which just nukes your whole cache

Posted by @micstriit on slack, posting here for everyone else and so it doesn’t get lost. Slack

I have created an example function where you can define a specific template and Lucee will remove that template from the pool, but also the class itself (under cfclasses) and no time (performance) issue

function forceRecompilation(required string path) {
    // resolve relative path
    if(left(arguments.path,1)!="/")local.path=contractPath(expandPath(arguments.path));
    var pc=getPageContext();
    var ps=pc.getPageSource(path);
    var mapping=ps.getMapping();
    var dir=mapping.getClassRootDirectory();
    var clazz=dir.getReal(replace(ps.getClassName(),".","/","all"))&".class";
    if(fileExists(clazz)) fileDelete(clazz);
    ps.clear();
} 
1 Like