-
1. Re: Refreshing a portlet's cache
antoine_h Jan 18, 2007 10:27 AM (in response to nollie)Hello,
I am looking for quite the same.
the main thing is to drop the cache.
did you find a way to drop the cache, for one portlet independently ?
how this can be done ?
thank you, -
2. Re: Refreshing a portlet's cache
nollie Jan 18, 2007 11:19 AM (in response to nollie)Unfortunately, no I didn't find a good way to do this. At one point I had my scheduler bean running but I hadn't figured out how to be sure that it was using the same classloader as my portlet.
Since my cache refresh was under 10 seconds we decided to let one user per day take the 'hit' and table the issue. In the future when we are using EJBs I'll revisit this.
Here is a very simple timer example:
CacheDumpScheduler.java:package com.foo; import java.util.Date; import org.jboss.varia.scheduler.Schedulable; public class CacheDumpScheduler implements Schedulable { public void perform(Date now, long remainingRepetitions) { MyPortlet.resetCache(); } }
META-INF/jboss-service.xml:<?xml version="1.0" encoding="UTF-8"?> <server> <mbean code="org.jboss.varia.scheduler.Scheduler" name="com.foo:service=CacheDumpScheduler"> <attribute name="StartAtStartup">true</attribute> <attribute name="SchedulableClass"> com.foo.CacheDumpScheduler </attribute> <attribute name="SchedulableArguments"> </attribute> <attribute name="SchedulableArgumentTypes"> </attribute> <attribute name="InitialStartDate">NOW</attribute> <attribute name="SchedulePeriod">6000</attribute> <attribute name="InitialRepetitions">-1</attribute> <depends>jboss.web:service=WebServer</depends> </mbean> </server>
Hope that helps
Jon -
3. Re: Refreshing a portlet's cache
antoine_h Jan 18, 2007 2:37 PM (in response to nollie)Hello,
Thanks for the answer and the scheduller... but what I first need to do is to reset the cache of one portlet.
what is in this method ?
MyPortlet.resetCache();
did I missed something obvious about the portlet cache (and JSR-168)?
(I mean the UI and the html fragment cached between two requests).
how can you say : reset the cache now for this portlet ?
and force to go throught the doView method, even if the cache timeout is not over.
It is not supposed to be done in the JSR-168 and I am looking for a "special JBoss portal implementation of cache" way to do it.
Thanks again,
Antoine -
4. Re: Refreshing a portlet's cache
nollie Jan 18, 2007 2:46 PM (in response to nollie)What are you caching?
My portlet was caching some statistics from the database. These stats only change late at night, so there was no reason for me to perform the same query all day long. The idea behind my timer was to tell my portlet to access the DB again and save the new data.
if you are talking about jboss caching your portlet or HTML fragment, my solution is probably not what you want. In my experience you can change the HTML or JSP fragments while the server is running and it will pick up the changes. However, the server will not pick up changes to the class files or properties files of your portlet. That requires a restart (or maybe just touching application.xml). -
5. Re: Refreshing a portlet's cache
julien1 Jan 19, 2007 5:51 AM (in response to nollie)You want to invalide the portlet cache per user and per window ?
-
6. Re: Refreshing a portlet's cache
antoine_h Jan 30, 2007 12:33 PM (in response to nollie)yes... per user and per window
to be able to refresh a portlet when some IPC messages tell him that "things have changed".
as an example : for navigation and have a menu that follow the change in the rest of the portal.
thanks -
7. Re: Refreshing a portlet's cache
analyzediz Nov 3, 2008 12:35 AM (in response to nollie)Was there a resolution to this problem???
Thanks.