cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Donald Ball <ba...@webslingerZ.com>
Subject RE: XSP: caching?
Date Thu, 03 May 2001 20:59:02 GMT
On Thu, 3 May 2001, Tony wrote:

> I tried everything like hasChanged(), isCacheable(), hasTheHellChanged()
> (just kidding) but no luck so far.
>
> In my site, a lot of my XML page elements (dynamic forms and so) come from a
> database. Thus without a proper XSP cache working I'm not going anywere.
>
> Could someone give us a simple XSP example on how to make the cache work on
> Cocoon 1.8.2 ?

    static long last_changed_millis = 0;
    static final long MILLISECONDS_TO_CACHE = 60*1000;

    public boolean hasChanged(Object context) {
      long current_millis = System.currentTimeMillis();
      if (current_millis - MILLISECONDS_TO_CACHE &gt; last_changed_millis) {
        last_changed_millis = current_millis;
        return true;
      } else {
        return false;
      }
    }

    public boolean isCacheable(HttpServletRequest request) {
      return true;
    }

(turns out i was wrong about the signature. look to the source, guys!)

- donald


---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

To unsubscribe, e-mail: <cocoon-users-unsubscribe@xml.apache.org>
For additional commands, e-mail: <cocoon-users-help@xml.apache.org>


Mime
View raw message