Nice, thanks :) -- Edvin
Igor Vaynberg skrev:
i would just let the base cms page implement imarkupcachekeyprovider -igor On Tue, Aug 26, 2008 at 2:28 AM, Edvin Syse <[EMAIL PROTECTED]> wrote:Hi, I have a virtualhosted CMS written in Wicket 1.3 where some of the pages are loaded from the database. This is done using a custom ResourceStreamLocator, configured in the Application#init method. This works good. Different users have different templates loaded for the same Wicket page, so I need to provide a custom cache key so that instance #2 doesn't get the template loaded for instance #1. Therefore I have overriden the MarkupCache class to be able to override the MarkupCacheKeyProvider. This also works, my CacheKeyProvider is consulted, but not always used for MarkupCache#putIntoCache(). Shouldn't the key returned from the CacheKeyProvider always be used when calling putIntoCache()? Here is my MarkupCache implementation: public class TornadoMarkupCache extends MarkupCache { private IMarkupCacheKeyProvider markupCacheKeyProvider; public TornadoMarkupCache(Application application) { super(application); } protected Markup putIntoCache(String locationString, Markup markup) { System.out.println("Putting " + locationString + " into cache"); return super.putIntoCache(locationString, markup); } public IMarkupCacheKeyProvider getMarkupCacheKeyProvider(MarkupContainer container) { if (container instanceof IMarkupCacheKeyProvider) { return (IMarkupCacheKeyProvider)container; } if (markupCacheKeyProvider == null) { markupCacheKeyProvider = new TornadoMarkupCacheKeyProvider(); } return markupCacheKeyProvider; } } And here is my CacheKeyProvider: public class TornadoMarkupCacheKeyProvider extends DefaultMarkupCacheKeyProvider { public String getCacheKey(MarkupContainer container, Class clazz) { String key = TornadoSession.get().getInstanceId() + "/" + super.getCacheKey(container, clazz); System.out.println("Setting key " + key); return key; } } I typically see things like this: Setting key 1/no.sysedata.wicket.components.InfoPanelnohtml Putting file:/C:/Users/edvin/projects/tornado/target/classes/no/sysedata/wicket/components/InfoPanel.html into cache .. so it seems the CacheKeyProvider is consulted, but the key is not used for MarkupCache#putInfoCache() Can someone point me to what I'm missing? Thanks! -- Edvin Syse --------------------------------------------------------------------- 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]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
