Control caching of your RIA applications
There’s actually a chance that a user won’t see the latest version of your application, the chances are actually quite high for that to happen.
Well, I have my own two methods that I use to control this.
The first way to control this is by the use of a parameter attached to the file name.
Lets say your file name is kenso.swf (original name I must say ). If you try embedding it into the HTML you will found out it is being cached. If you update the file on the server, you won’t see the changes.
The solution for this is simply add a parameter to the file like so: kenso.swf?buildDate=29Jan2009, this will cache as a file, if you change the buildDate param you will see that the file is being pulled again from the server
This method is what I call overkill, but I did found myself using it a couple of times in the past.
I won’t get into code (unless you ask me to…), but the idea is this. There’s a service managing the builds of the application.
Each build of the application has an ID embedded inside the code like so:
OK, so now we have the version label in the application. All we have to do is create a service, set the final version expected there say
If the version passed into the service is not the latest, simply tell that to your user.
I seriously recommend using the 1st way to do this unless you really want to make sure that the version your user is seeing is the latest.Submit to Hacker News
[NOTE] This post has been imported to Hugo from a Wordpress blog. It may be broken, missing images, code snippets or other information.
[NOTE] updated April 27, 2009. It's 3563 days old . This article may have outdated content.