History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: CACHE-160
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Minor Minor
Assignee: Lars Torunski
Reporter: Fernando Martins
Votes: 0
Watchers: 2
Operations

If you were logged in you would be able to see more operations.
OSCache

ExpiresRefreshPolicy always set in CacheFilter

Created: 04/Apr/05 07:38 AM   Updated: 08/Apr/05 12:05 AM
Component/s: Filters
Affects Version/s: 2.2 RC
Fix Version/s: 2.2 RC


 Description  « Hide
CacheFilter creates CacheEntry's always with policy set to ExpiresRefreshPolicy, which results in the following behaviour if I specify time initParam in filter definition in web.xml and I don't set expires header in my servlets:
CacheEntry.needsRefresh is called, since policy is set the policy.needsRefresh is checked which compares the current time with the time set in the ResponseContent. Now, since I don't specify any expires, ResponseContent has default value Long.MAX_VALUE, which results in policy always returning false since System.currentTimeMillis() is always less than responseContent.getExpires().
This is not the behaviour I would expect from CacheFilter, if a time initParam is set.
I should not need to set expires header in my servlets in order to use the cachefilter, or should I?

Any suggestions on how to resolve this?

 All   Comments   Change History      Sort Order:
Lars Torunski - [04/Apr/05 02:41 PM ]
Thanks to Fernando reporting this bug. The affected version is 2.2 only, because the ExpiresRefreshPolicy is going to be introduced with release 2.2.

The problem is that in CacheEntry::needsRefresh the policy is used (if set) to check a needed refresh and not the specified time (in initParam in the filter definition of web.xml).

Lars Torunski - [05/Apr/05 01:33 AM ]
I opened a discussion about the method CacheEntry::needsRefresh:
http://forums.opensymphony.com/thread.jspa?threadID=1283&tstart=0

Lars Torunski - [05/Apr/05 05:07 PM ]
The ExpiresRefreshPolicy contains a refresh period now which is set in the CacheFilter::init method based on the time init parameter.

Until now the policy is always set. We can avoid this by a workaround submitted in the forum thread. Any suggestions?

Fernando Martins - [06/Apr/05 03:42 AM ]
I've tested it and it works correctly now, thanks for the quick fix.