Archive for February, 2009

Clearing and Busting the GWT Hosted Mode Cache

Sunday, February 1st, 2009

We’ve chosen to use GWT for Beaver Creek Consulting’s latest product (Simply Schedules).  The back end is a REST API with JSON payloads.

I was having trouble with the hosted mode browser.  A list of application objects for a luser are loaded with a request to the server such as:

GET /app/luser/items

The issue is that as the application runs, the list of items on the server changes.  Next time I tried to load the list of items from the server, the hosted browser sees the same URL and decides to use the cached response.

This post on the GWT forum recommended clearing the IE (if you are on windows) cache.  I needed something more permanent as the cache issue is part of the normal operation of the client (this is to say it modifies the items).

The correct answer is to not clear the cache, but to bust the cache.  A little bit of research shows that appending a query parameter with a random number or a timestamp will do the trick.  For the above example, I used the current timestamp:

GET /app/luser/items?cache-buster=1233516109751

The timestamp is generated in “Java” on the client:

String url = "/app/luser/items?cache-buster=" + new java.util.Date().getTime();

It’s quite likely that you don’t even need to name the parameter, just append the time stamp:

GET /app/luser/items?1233516109751

You can have Perl 5 when you peel my cold dead hands off of it.

Sunday, February 1st, 2009

I started working with Perl in 2000 and along with C++ Perl is the language I cut my teeth on as a professional developer.

5.8 has been my favorite release.   With Perl 6 taking a while to be production ready I’ve been planning on using 5.8 forever.  Well, it turns out forever isn’t that long.  The end of Perl 5.8 has been announced.  The good news is that Perl 5 will continue as Perl 5.10.

Maybe I’ll never upgrade to Perl 6.  Perhaps this point is moot, as I’m using Perl less and less these days.  I’ve been turning to Groovy.

But — when I need something complicated done right now, my goto is Perl 5.