The best practice
It is wise to have a good HTTP cache policy for your web site. It helps to reduce the cost of bandwidth, it gives a better user experience by not having to download each time you request a resource. Read Mark Nottingham’s post on tips for building a cache aware site.
The issue
When creating a social network site, some assets, such as avatars, require a contradictory HTTP cache policy.
- Avatars images need to be cached for not having to download them at each HTTP request
- Avatars images need to be refreshed each time they have been changed by the user. The user expects his, her image to change right away.
The solution
Usually, for highly dynamics assets, people use cache busting to force the refresh. The issue is that we still want the avatar images to be cached.
http://example.org/myavatar.jpg?dijfHG635jhdu
On RDS social network site, Le Grand Club, we recently implemented among other strategies a better cache policy for avatars. We used a timestamp in seconds of the last modification date of the avatar image.
http://example.org/myavatar.jpg?1242843683
This will smooth the experience of users on the longterm. Managing RDS Web sites is challenging, it pushes the limits for performance and optimization. We are researching, tweaking, improving the code on a daily basis.