掲示板

Disable Velocity macro caching

14年前 に Thomas Kellerer によって更新されました。

Disable Velocity macro caching

Expert 投稿: 490 参加年月日: 08/06/09 最新の投稿
Hi,

we include some (inline) macros into the Velocity templates of our theme.

The problem with that is, that Velocity by default caches the macros even if the overall Velocity cache is disabled (using velocity.engine.resource.manager.cache.enabled=false )

There is a property for the Velocity engine to enable an auto-reload feature for macros (using velocimacro.library.autoreload=true) but I can't find a way to specify that for my Liferay 5.2.3 installation.

Any ideas?

Thanks
Thomas
14年前 に Thomas Kellerer によって更新されました。

RE: Disable Velocity macro caching

Expert 投稿: 490 参加年月日: 08/06/09 最新の投稿
I guess no answer means this is not possible emoticon

That's really a shame, because using macros really makes the Velocity templates easier to maintain but if I cannot change them without restarting the server this is hardly usable...
14年前 に Arun Kumar S によって更新されました。

RE: Disable Velocity macro caching

Regular Member 投稿: 182 参加年月日: 08/06/23 最新の投稿
Hi Thomas,


Refer this thread

HTH,
Arun
14年前 に Thomas Kellerer によって更新されました。

RE: Disable Velocity macro caching

Expert 投稿: 490 参加年月日: 08/06/09 最新の投稿
Thanks for the answer, but I'm talking about Velocity macros not velocity templates.

I can define a macro inside a template and that macro will be cached by Velocity unless the property velocimacro.library.autoreload=true is defined for the Velocity engine.

Consider the following Velocity template (e.g. a in a Theme)
#macro ( anchor $url $text)
  <a href="$url" class="footer-link">$text</a>
#end

#foreach ($entry in $nav_items )
  #anchor($entry.getURL(), $entry.getName())
#end

Now when I make a change to the template (e.g. in the foreach loop) the change is picked up (because of layout.template.cache.enabled=false) but Velocity will not reload the macro definition as that is a separate cache area inside the Velocity engine. I need to restart Liferay so that Velocity picks up a change in the anchor macro.
thumbnail
7年前 に Fernando Fernandez によって更新されました。

RE: Disable Velocity macro caching

Expert 投稿: 396 参加年月日: 07/08/22 最新の投稿
Thomas Kellerer:
(...) I need to restart Liferay so that Velocity picks up a change in the anchor macro.


Had the problem with 6.2 CE. The (lousy) workaround I was using was to change the macro name each time, instead of restarting Liferay. :-/

But the velocity.engine.resource.manager.cache.enabled=false parameter you mentioned seems to work now.

Thanks

Fernando