|
Server caching can speed dynamic pages to near-static speeds. Many pages created by database queries only change every 15 minutes or so, e.g. CNN or Slashdot. Resin can cache the results and serve them like static pages. Resin's caching operates like a proxy cache. Every user shares the same cached page.
Setting the header will cache the results until the time expires. For heavily loaded pages, even setting short expires times can significantly improve performance. Sessions should be disabled for caching.The following example sets expiration for 15 seconds. So the counter should update slowly.
is useful for database generated pages which are continuously, but slowly updated. To cache based on something with a known modified date, like a file, you can use .
The headers let you cache based on an underlying change date. For example, the page may only change when an underlying source page changes. Resin lets you easily use by overriding methods in HttpServlet or in a JSP page.The following page only changes when the underlying 'test.xml' page changes.
Resin can cache subpages even when the top page can't be cached. Sites allowing user personalization will often design pages with subpages. Some subpages are user-specific and can't be cached. Others are common to everybody and can be cached.Resin treats subpages as independent requests, so they can be cached independent of the top-level page. Try the following, use the first counter example as the included page. Create a top-level page that looks like:
|