Re: [Opensymphony-oscache] CacheEntry::needsRefresh

Fernando Martins <[email protected]> (by way of Fernando Martins <[email protected]>)
Newsgroups gmane.comp.java.open-symphony.os-cache
Message-ID <[email protected]>
I think that policy can be checked first in the CacheEntry but ONLY if
ExpiresRefreshPolicy is by default set empty in CacheFilter.
That way, without specified an explicit ExpiresRefreshPolicy, one would get
the default behaviour of refreshing every period seconds specified in the
web.xml. Then one could set an optional ExpiresRefreshPolicy strategy
(matching to a concrete class) as an initParam in web.xml which would then
have precedence over the refreshPeriod mechanism.

Fernando Martins

On Tuesday 05 April 2005 05:37, Lars Torunski wrote:
> Reviewing the class CacheEntry and it's method needsRefresh due to a bug
> (Cache-160), I don't understand why isn't the parameter refreshPeriod is
> used if a policy is set:
>
> ....
>         else if (policy != null) {
>             needsRefresh = policy.needsRefresh(this);
>         }
>         // check if the last update + update period is in the past
>         else if ((refreshPeriod >= 0) && (System.currentTimeMillis() >=
> (lastUpdate + (refreshPeriod * 1000L)))) { needsRefresh = true;
>         } else {
>             needsRefresh = false;
>         }
>
>
> According to the javadoc my interpretation of the method is:
>
> ...
>         // check if the last update + update period is in the past
>         else if ((refreshPeriod >= 0) && (System.currentTimeMillis() >=
> (lastUpdate + (refreshPeriod * 1000L)))) { needsRefresh = true;
>         }
>         // check what the policy has to say if there is one
>         else if (policy != null) {
>             needsRefresh = policy.needsRefresh(this);
>         }
>
> This class was never changed, so this may not be a bug. But I think we have
> to correct this.
>
> Objections and suggestions anyone?
>
> ---------------------------------------------------------------------
> Posted via Jive Forums
> http://forums.opensymphony.com/thread.jspa?threadID=1283&messageID=4038#403
>8
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.