I'm trying to implement a Partial Page Cache dialect extension for Thymeleaf and while I already have a running version there is still some mayor improvement to be done. So i could use some hints on how to proceed from here:
Currently I use the fragment cache to cache the partial page: arguments.getTemplateEngine().getCacheManager().getFragmentCache().
Is there a timeout of cache entries in these caches or should I add a specific cache which handled entry timeouts explicitly? I think the Fragment cache is permanent and only evicts on cache size right?
Currently I cache the processed element tree as a DOM structure and call setProcessable(false) once they are found and replaced by the CacheProcessor. Thats obviously not perfect from the performance point of view.
Is there a way to get the rendered output of a DOM structure on the server side? I have not found an entry point in the TemplateEngine and I don't think there is something i could call on the Node right? Then i would put the resulting String into the cache and use the Marco class where I could set the content so that this would just be written straight to the response.
For those interested, the dialect is on GitHub:
Think about menu which should be dynamic per user role, etc.
Currently, even in this not optimized version, I'm able to get +-50% of response time for a cached list with 1000 elements.
Re: Partial Page Caching Extension, some questions
I use the same approach, just that it is part of the processor directly.
This helps in getting the final DOM but they are still nodes at this time. What i would like to get is the final output of these elements as a string. This string i would cache and place it with the help of the Macro object into the DOM.
I just took a quick look at your validation dialect and if i'm right you are validating not the resulting output but rather each final element and its attribute. Is that correct?