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

Key: CACHE-58
Type: New Feature New Feature
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Lars Torunski
Reporter: nishant kumar
Votes: 1
Watchers: 2
Operations

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

Check If-Modified-Since header in cache filter

Created: 16/Sep/03 05:27 AM   Updated: 23/Jan/05 04:41 PM
Component/s: Filters
Affects Version/s: 2.0.2
Fix Version/s: 2.1

File Attachments: 1. Zip Archive bugfix-CACHE-58.zip (9 kb)

Issue Links:
Duplicate
 
This issue is duplicated by:
CACHE-70 last modified problem Major Closed
Related
 
This issue is related to:
CACHE-116 CacheFilter sends back a 304 (not mod... Critical Closed


 Description  « Hide
say i have a servlet that has overridden the getLastModifed method to return the last time the response was modified. client can use this info while making a conditional request using the "If-Modified-Since" header. if the content has not been modified since the time specified then just 304 status is returned and no content. this can reduce traffic a lot if the content changes infrequently.
now say i use the cache filter from oscache. in this case it just look for the response content in the cache. if it is there then the whole content is written to the servlet outputstream and the If-Modified-Since header is completely ignored.
you already have the last updated time info in the cache entry class. can that be used together with "If-Modified-Since" header in cache filter.


i had one more suggestion. suppose i have many pages on my site that change quite infrequently, say once a day. these pages are large too. so i want to save the response on disk not just as is but also in gzip format. so if any client accepts gzip encoding i can send him the gzip cached version, which should be much smaller than the full blown version. can this be incorporated. sample of compress filter comes with the source code of tomcat.

one more thing. while generating the key in cache filter null is passed as the first argument to the following method.
admin.generateEntryKey(null, (HttpServletRequest) request, cacheScope)

can this be changed to some request attribute, say
"com.opensymphony.module.oscache.web.filter.CacheEntryKey". i mean if this attribute is set in the request then that key is passed else null is passed. this way i can pass some sensible keys, not some MD5 encoded key.

thanks,
nishant.

 All   Comments   Change History      Sort Order:
Lars Torunski - [28/Mar/04 10:06 AM ]
The "Last-Modified" is very useful to improve the performance.

Kurt Williams - [20/May/04 06:45 PM ]
I've managed a quick fix to this problem. With minor modifications to three files in the filter package, OSCache can now implement the If-Last-Modified check and sets the Last-Modified header properly.

I've marked my fixes plainly in the files.

I haven't had time to do much testing, so use at your own risk! I'll see what I can do to get this into a format palatable to the committers.

Kurt Williams - [20/May/04 07:04 PM ]
I don't know if my fix is suitable for the project or not, but I thought you might at least find it helpful. Basically I added a LastModified property to the ResponseContent class, added a little code in the WriteTo to write out the Last modified header, tweaked the setDateHeader in the CacheHttpServletResponseWrapper to catch the Last-Modified header, and added a very small short-cirtuit to the Filter to catch requests with "If-Last-Modified" and send them an SC_NOT_MODIFIED response.

Chris Miller - [23/May/04 04:14 PM ]
Thanks Kurt, this is now in CVS