Re: Dependency mapping in OSCache?
Chris Miller <[email protected]>
| Newsgroups | gmane.comp.java.open-symphony.os-cache |
|---|---|
| Message-ID | <[email protected]> |
This is the type of problem the cache grouping functionality can be used to solve. In fact, we do something very similar to what you want in our in-house CMS product. Pages that are rendered can contain many pieces of subcontent, so obviously if one of these pieces of subcontent changes we need to expire the cached page(s) that it appears on. During rendering, a note is made of each piece of content that contributes to the page. After rendered when the page is cached it is put into several groups, one corresponding to each piece of content it depends on. So for example a particular page might end up in groups "C100", "C145", "C170" (where the number == the appropriate contentId). Whenever a piece of content is updated we can just flush eg group "C145" which causes all the dependent pages to flush too. All this is done with a custom CacheAdministrator class that takes special Key objects and RenderedContent objects. The RenderedContent objects hold the rendered data to cache, plus info such as the cache dependencies, locale information, any dependent URL parameters and the like. We actually take things a lot further than this. For example rendered subcontent is cached seperately too so even if a page has been flushed because eg a news item has been updated, parts of the page such as menus, headers & footers will still be retrieved from cache. We also have a post-cache processing stage where request or session specific data (such as user names, the current time etc) can be injected into the page. Hope this helps get you started. Chris PS: I've posted this to the OSCache mailing list, generally that's the best place to ask questions. Michael Guyver wrote: >Hi Chris, > >Sorry for the liberty of contacting you directly, but I couldn't see a >"contact us" link on the website. > >Is there some sort of object in which you can store dependency mappings in >OSCache? I haven't used it but am not sure whether to continue with my >efforts or adopt it instead. I have composite objects and would like to be >able to ensure that if someone updates a constituent part that any objects >which depend on it are released from the cache. > >I had a quick look through the docs and it looks like I'd have to maintain >the dependency mapping and then programmatically cause the caches to flush >the dependent objects by key. If there's an easy way or if I've missed >something, please let me know! > >Best wishes, > >Mike > ------------------------------------------------------- This SF.Net email is sponsored by: SourceForge.net Broadband Sign-up now for SourceForge Broadband and get the fastest 6.0/768 connection for only $19.95/mo for the first 3 months! http://ads.osdn.com/?ad_id=2562&alloc_id=6184&op=click