Open Social Caching
When you are developing your gadget you will come across some of the caching measurements we implemented. Caching is done to lower the load on both your and our servers and provide quicker loading times for users. This means the gadget spec won't have to be downloaded for each request and even images and flash files can be cached on our servers. The gadgets and resources are cached on the client (browser) and on the gadget render server (shindig).
What is being cached?
- Gadget spec (XML)
- Message bundle (locale) (XML)
- Proxied Requests
- Images, stylesheets, Javascript, Flash from Gadgets
- URL requests: io.makeRequest(), both normal and signed
Circumventing the cache
Gadget XML
Gadgets are cached both on the client and server until they are automatically invalidated by us or manually by you.
- No cache
- First of all there's the sandbox. When you are actively developing you most likely don't want any caching of your gadget spec. The sandbox does not cache the gadget xml (turn on sandbox mode on http://www.hyves.nl/api/opensocial/). On the canvas page you can also set ?nocache=1 in the URL to render the gadget without caching.
- Automatically
- We automatically request the gadgets each day to see if anything has changed. If this is the case, we change the version in the URL of the gadget, effectively invalidating the cache in the browser and server. The gadget render server respects the caching headers of your gadget spec XML response. If you want your gadget to be refreshed more often, you can set the Expires header.
- Manually
- Instead of waiting for our daemons to pick up your changes you can manually refresh the gadget. You can do that here: http://www.hyves.nl/?module=gap&action=showGapRefreshPage.
Message bundle (locale)
Message bundle xml files are used for multi language gadgets.
- No cache
- The sandbox does not cache the message bundle XML.
- Automatically
- The gadget render server respects the caching headers of your message bundle XML response. If you want your message bundle to be refreshed more often, you can set the Expires header on your own server.
- Manually
- Change the URL of the message bundle in your gadget, for example by adding a version number.
Proxied requests
When you do a proxy request using io.makeRequest() the response is automatically cached by our proxy server. Both normal and signed requests are cached. Caching is done based on the url (including parameters) you proxy through us. Only GET requests are cached, POST requests are not cached. You can see an example of a proxied Flash gadget on OpensocialSnippets#AdobeFlash
- No cache
- There's no way to completely bypass caching of proxied requests for GET requests. POST requests are not cached.
- Automatically
- The gadget render server respects the caching headers of your proxied requests. If you want your resource to be refreshed more often, you can set the Expires header on your own server.
- Manually
- By adding a variable, like the current time, to your requests you can effectively bypass the caching because this makes the URL unique. This can be especially useful to do a fresh request every x minutes. A tutorial on how to do this can be found here: http://code.google.com/apis/opensocial/articles/makerequest-0.7.html#caching.
