aiScaler Header-driven cache invalidation example
Posted by Max Robbins on October 25th, 2010The Header-driven Cache Invalidation.
This feature is best explained by an example. Let’s say you have a message board web site where you want to cache discussion threads and forum fronts. Yet at the same time, when a new message is added to the thread, you want to content of the respective discussion thread to be refreshed right-away, so that the newly added article is seen by visitors as soon as possible (and the posters are not confused when the message they posted doesn’t show up in the thread as they certainly expect).
aiCache once again comes to the rescue and allows you to eat your cake and still have it.
All you have to do is to send a header called X-expireURL in the response to a post, identifying the URLs to be invalidated (expired) as the value. For example, assuming an on-line forum that uses a popular forum software:
X-expireURL: /acme-bb/forumdisplay.php?f=123
would expire particular forum page, while
X-expireURL: /acme-bb/showthread.php?t=123456
would expire a particular thread page . You can send multiple headers with that name to expire multiple cached responses. You might want to expire both the sub-forum page and particular thread – it is up to you.
Do not specify host name or “http://” prefix in X-expireURL header, follow the format in the example above.