Thursday, March 09, 2006

What does the "cache" argument in LzView.setSource do?

According to the OpenLaszlo Reference, LzView has three arguments: source, cache, headers. The cache parameter, "if set, controls caching behavior. Choices are none , clientonly , serveronly , both (the default)."

In debugging, I wanted my resource (a jpg image, for example) not to be cached, and I thought setting cache to "none" would fix this. This seems to be the case when running LPS (Laszlo Presentation Server) on localhost. I set cache to "none" and checked my Firefox cache using the about protocol (specifically, "about:cache?device=disk", and ok, I know I could just look for the files on my harddrive but the about protocol is my new toy). The resources were not in the cache. Then I set cache to "clientonly" and I saw that Firefox was caching the resource.

But when you go SOLO, it appears that this setting is irrelevant. I don't know enough about Flash/SWF/OpenLaszlo to understand this. The documentation does not really spell this out for you, certainly not in the Reference. If you read through the section on Media Resources in the Guide, it's not perfectly clear either.

My tentative conclusion is that when using your OpenLaszlo SWF in SOLO mode you have to rely on your server to control caching. Generally I am not concerned about this problem for deployment, but during the build/debug phase it's a problem. Currently I am clearing the browser cache to force resources to refresh. I've played around with my Apache server settings (the <Files> ExpiresDefault and ExpiresAccess directives) but nothing seems to work.

0 Comments:

Post a Comment

<< Home