velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Steve O'Hara <soh...@pivotal-solutions.co.uk>
Subject RE: Macros interfering with each other when caching turned on
Date Thu, 07 Jun 2012 15:22:17 GMT
Whoops, some more clarity......

We use a custom resource loader that reads templates from a database.  It uses a database
column to determine the last updated date so it can tell Velocity if the template needs reloading
or not.
We also use a pool of Velocity engines.

The problem we have is to do with macros that are contained within an included template.
For example, we have a template called x_dataservice.vm as follows;

#parse("/database/x/lib_macros")
#myMacro()

The server is multi-tenancy where x is the customer name so we will have the following template
y_dataservice.vm also;

#parse("/database/y/lib_macros")
#myMacro()

Each lib_macros template is particular to each customer and will contain the same named macros
but with different macro bodies.

When caching is turned on, we get some sort of crossover between all the macros that share
the same name, despite the fact that are loaded from different parents.
To help eliminate our resource loader, I created a custom cache provider so that I could see
that we are definitely hitting the correct templates.  I even changed the isSourceModified
to always return true, to no avail.
As soon as I turn caching off, it all works fine.

I'm wondering if there is some sort of global macro cache because it doesn't seem to be caused
at the template cache level.

Any ideas?

Thanks
Steve

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
For additional commands, e-mail: user-help@velocity.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
For additional commands, e-mail: user-help@velocity.apache.org


Mime
View raw message