The caching system in Roller is pretty generic and flexible, so you should have no problem accomplishing what you want. Start by looking at the CacheManager class. That class allows you to create a Cache object which you can use to hold whatever you want.

The trickier part will be putting in the code which actually gets/sets the Model in the cache before it's used for rendering. The assumption in Roller is that Model classes are often contextual objects and thus only pertain to a single request, so they are meant to be created, used, and discarded within the lifecycle of a single request.

To change that you'll have to rework some of the code which creates Model classes to make use of your caching. This would most likely be in one of Roller's rendering servlets, such as PageServlet, FeedServlet, etc. Look in those classes where the Model objects are created and tweak as necessary.

HTH,

-- Allen


Brian Levine wrote:

Hello all,

For the project I've been working on, I've created a new Model (by extending 
PageModel) that I want to use for rendering pages.  Specifically I've added it 
to the list of rendering.pageModels in my roller-custom.properties.  When the 
model gets initialized it makes database calls that take some time to complete, 
and its only going to tale longer as the DB gets bigger.  The data that the 
model gets from the DB will only change once a day at most, so I was wondering 
if there is a good way to cache this data?

From what I've seen, roller can cache individual pages, which helps me out 
somewhat.  But a lot of the pages won't be cached and so the model will go out 
and get the same data over and over again from the DB.  Has anyone had similar 
issues?  Is there a good solution?  Can roller cache the contents of models?  
Is anyone else wondering how long I can keep stringing questions together?

Thanks!
/Brian

_________________________________________________________________
Make Windows Vista more reliable and secure with Windows Vista Service Pack 1.
http://www.windowsvista.com/SP1?WT.mc_id=hotmailvistasp1banner

Reply via email to