T4: Instance method dangers
I want to cache a rountrip to a database in an instance method of a page class like this: public FlowDataPageContent getFlowDataPageContent() { if (_pageContent == null) { _pageContent = getContentService().getFlowDataPageContent(/* some data in an ASO */); } return _pageContent; } content service is injected by Spring. Am I going to get into threading/concurrency problems here? Is there a more elegant way to avoid multiple round trips to the database accessed by my service? Bill - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: T4: Instance method dangers
It's thread safe. A more elegant method may be to push the caching out to something more generic like your database or object caching strategies such as is used in things like hibernate. Some properties - such as those passed in as parameters to components - are sometimes cached by tapestry during render already as well. On 8/16/07, Bill Holloway [EMAIL PROTECTED] wrote: I want to cache a rountrip to a database in an instance method of a page class like this: public FlowDataPageContent getFlowDataPageContent() { if (_pageContent == null) { _pageContent = getContentService().getFlowDataPageContent(/* some data in an ASO */); } return _pageContent; } content service is injected by Spring. Am I going to get into threading/concurrency problems here? Is there a more elegant way to avoid multiple round trips to the database accessed by my service? Bill - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Jesse Kuhnert Tapestry/Dojo team member/developer Open source based consulting work centered around dojo/tapestry/tacos/hivemind. http://blog.opencomponentry.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: T4: Instance method dangers
Thanks! I'll talk to the service layer/Spring people tomorrow about pushing the caching down into the service there. They've been thinking about using os cache or something. bill On 8/16/07, Jesse Kuhnert [EMAIL PROTECTED] wrote: It's thread safe. A more elegant method may be to push the caching out to something more generic like your database or object caching strategies such as is used in things like hibernate. Some properties - such as those passed in as parameters to components - are sometimes cached by tapestry during render already as well. On 8/16/07, Bill Holloway [EMAIL PROTECTED] wrote: I want to cache a rountrip to a database in an instance method of a page class like this: public FlowDataPageContent getFlowDataPageContent() { if (_pageContent == null) { _pageContent = getContentService().getFlowDataPageContent(/* some data in an ASO */); } return _pageContent; } content service is injected by Spring. Am I going to get into threading/concurrency problems here? Is there a more elegant way to avoid multiple round trips to the database accessed by my service? Bill - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Jesse Kuhnert Tapestry/Dojo team member/developer Open source based consulting work centered around dojo/tapestry/tacos/hivemind. http://blog.opencomponentry.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]