templates in separate workspace (freemarker) (MGNLINTEMPL-1)

[MGNLINTEMPL-3] templates in workspace: load template from workspace Created: 30/Sep/08  Updated: 02/Dec/13  Resolved: 08/Oct/08

Status: Closed
Project: Magnolia In-place templating Module (closed)
Component/s: base system
Affects Version/s: 1.0
Fix Version/s: 1.0

Type: Sub-task Priority: Major
Reporter: Philipp Bärfuss Assignee: Jan Haderka
Resolution: Fixed Votes: 0
Labels: mme_sprint2
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Template:
Date of First Response:

 Description   

Load the templates from the workspace (before they are loaded from the classpath). Few points have to be considered:

  • ensure that the templates are cached / flushed on change
  • make the freemarker helper configurable (c2b) to customize the template loading
  • the workspace loader is not CE but ME only


 Comments   
Comment by Jan Haderka [ 07/Oct/08 ]

Caching/Flushing of templates is controlled by CacheStorage rather then by TemplateLoader directly. All template loader has to do is to deliver correct last update date of the template when asked.
For more details on caching see last section of http://freemarker.sourceforge.net/docs/pgui_config_templateloading.html

In might be interesting to make CacheStorage configuration loaded via c2b.

Comment by Philipp Bracher [ 07/Oct/08 ]

could we not cache the mod date in the template loader and just flush based on observation?

Comment by Jan Haderka [ 07/Oct/08 ]

This is how caching works currently:

  • By default TemplateLoader are queried for values every 5 seconds. This can be changed at configuration level by calling Configuration.setTemplateUpdateDelay(int seconds).
  • When called, following sequence is executed:
    • loader.findTemplate()
    • loader.getLastUpdateDate()
    • loader.getReader()

so IMHO caching the update date doesn't solve anything.
What we might want to do is to change the interval in which cached entries are rechecked for update, or set this interval to "never" and manually flush the template cache on template update.
At the moment I can't see any slowdown or significant overhead with current settings. Timing the operations above shows on average cca 1ms execution time for each op.
Note: The update interval is time elapsed since any given template was checked last time, not the fixed tick applied to all templates every time template is requested.

Comment by Jan Haderka [ 08/Oct/08 ]
  • TemplateLoaders are now configurable via c2b
  • JcrRepoTemplateLoader is installed only with ME
  • As for caching we keep the default FM settings of caching (recheck templates for updates if elapsed time since last use is more then 5 seconds). This can be revisited later if necessary.
Generated at Mon Feb 12 05:57:31 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.