I started last week a very big project where we decided to use the MG framework as rendering engine.

The site will have a huge traffic and will need to display many 'heavy portlets' different by user or context etc...

We started to make some test and investigations on how we could implement pur rendering architecture using the MG view caching system.  In short time we discovered that the cache declaration based on the include tag was not processed and considered by the framework.

The final result of our research job was that the only caching support "really" working was the once on the initial event object ( basically the first event called in a new request ).

This was a killer, not for the MG caching system per se ( we use an adapter to ehCache ) but because we completely needed to remove MG from the project. We then decided to make some more test and in a short time we could create a patch that allow  MG to cache views based on the declarations made in any single include xml tag.

So with this patch code like this :

<include name="myview" template="pages/web/css_js.cfm" cache="true" cacheKeyValues="id" cacheTimeout="3600"/>

will create a cache copy for 3600 seconds of the view based on the value of the id argument.

Please note that any keys looks for value into the event object  so, if you want to use sessionid as a cache key, you should push that into the event object on request start. Following a Sean Corfield suggestion the generate key now also consider the host where the view is processed, so If you run the same application from differents domains any domain generate a different cache.

We send code to Dan Wilson that is the MG maintainer for review and testing.

If you want to use and test ( do not use that in production cause is really not tested code ) downlaod the patch and replace the file /ModelGlue/gesture/eventrequest/EventContext.cfc. 

Send your feedback ( or share on MG mailing list ).

 

Credits goes especially to Cristian Costantini.


andreacfm