Oracle Web Cache Administration and Deployment Guide
Release 1.0.2

Part Number A86722-01

Library

Service

Contents

Index

Go to previous page Go to next page

6
Creating Rules for Cached Content

This chapter explains how to configure cacheability rules. It contains these topics:

Cacheability Rules Overview

Using Oracle Web Cache to specify cacheability rules, you can select to cache or not to cache content for static documents, multiple-version URLs, personalized pages, pages that support session tracking, and HTTP error messages.

Generally, when you assign cacheability rules, you specify the regular expression matching the URL and whether you want the documents contained in the URL cached or not cached. You then order the cacheability rules in order of priority. Higher priority rules are processed first.

For cacheable regular expressions that contain a document or a subset of documents that are not cacheable, give the non-cacheable documents a higher priority than the cacheable documents.

For example, if you want all documents starting with /cec/cstage?ecaction=ecpassthru cached except for /cec/cstage?ecaction=ecpassthru, you would enter the rules in the following order:

  1. ^/cec/cstage\?ecaction=ecpassthru (Don't Cache)

  2. ^/cec/cstage\?ecaction=ecpassthru.* (Cache)

    
    

If the order were reversed, all documents starting with /cec/cstage?ecaction=ecpassthru would be cached, including /cec/cstage?ecaction=ecpassthru.

If no cacheability rules are specified, then Oracle Web Cache behaves just as HTTP proxy cache does, that is, it relies on HTTP header information to determine what is cacheable. Generally, HTTP proxy caches only cache pages with static content.

Please note that cacheability rules use regular expression syntax, which is based on the POSIX 1003 extended regular expressions for URLs, as supported by Netscape Proxy Server 2.5.

When using POSIX regular expression, keep the following syntax rules in mind:

Table 6-1 shows examples of content to cache and how to enter regular expression syntax for corresponding cacheability rules for that content.

Table 6-1 Regular Expression Examples

Content to Cache  Regular Expression Syntax 

URL beginning with /machine/doc and ending in *.gif 

^/machine/doc/.*\.gif$ 

All Graphics Interchange Format (GIF) images 

\.gif$ 

/robots.txt file 

^/robots.txt$ 

All procedures in the new_employee package 

^/pls/enroll_db/new_employee 

Configuring Cacheability Rules

To configure cacheability rules:

  1. Start Oracle Web Cache Manager.

    See Also:

    "Starting Oracle Web Cache Manager" 

  2. In the navigator pane, select Administering Web Sites > Cacheability Rules.

    The Cacheability Rules page appears in the right pane.

  3. In the Cacheability Rules page, choose Create if not rules exist. If rules already exist, select a rule, and then choose Insert Above or Insert Below.

    The Edit/Create Cacheability Rule dialog box appears.

  4. In the URL Expression field, enter regular expression syntax, matching the URLs to which you want the cacheability rule to apply. Remember to use "^" to denote the start and "$" to denote the end of the URL.

  5. Select Cache or Don't Cache for the documents contained within the URL.

    If you select Cache, continue to Step 6. If you select Don't Cache, skip to Step 7.

  6. Select options for the fields that apply:

    GET/POST Caching

    Select or deselect to cache documents that contain GET, GET with query string, or POST HTTP request methods in forms.

    Important: If your Web site's GET with query string or POST methods are used for forms that make changes to the application Web servers or database, do not select Get with query string or POST. These options should only be selected if the forms are used in search forms.

    Expiration Rule

    From the list, select an expiration rule to apply to the documents. If you do not see an expiration rule suitable for the documents, choose Create A New Rule to create a new rule.

    See Also: Step 4 in "Configuring Expiration Rules"

    Multiple Documents with Same URL by Cookies

    Select None to not have Oracle Web Cache cache multiple-version documents that use cookies.

    Select Apply the following to have Oracle Web Cache cache multiple-version documents that rely on cookie values, and then select the required cookies. If you do not see a cookie rule that can be applied to these documents, choose Create A New Rule to create a new policy or modify an existing policy.

    See Also: Step 4 in "Configuring Rules for Multi-Version Documents Containing Cookies"

    Multiple Documents with Same URL by Other Headers

    Select the HTTP request headers whose values Oracle Web Cache will use to cache and identify multiple-version URLs.

    Accept: Specifies which media types are acceptable for the response

    Accept-Charset: Specifies which characters sets are acceptable for the response

    Accept-Encoding: Restricts the content-encodings that are acceptable in the response

    Accept-Language: Specifies the set of languages that are preferred as a response

    User-Agent: Contains information about the Web browser that initiated the request

    An example of a request made with a Netscape 4.6 browser with HTTP request headers follows:

    User-Agent: Mozilla/4.61 [en] (WinNT; U)
    Accept: image/gif, image/x-xbitmap, image/jpeg, 
    image/pjpeg, image/png,*/*
    Accept-Encoding: gzip
    Accept-Language: en
    Accept-Charset: iso-8859-1,*,utf-8
    
    

    Note: Oracle Web Cache does not interpret the values of these HTTP request headers. If the values for two pages are different, Oracle Web Cache caches both pages separately. For example, if one request sends a HTTP request header of User-Agent: Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 4.0) and another request sends a HTTP request header of User-Agent: Mozilla/4.0 (compatible; MSIE 5.0; Windows NT; DigExt) for different versions of Internet Explorer, Oracle Web Cache serves two pages.

    Session-Related Caching Rules

    Select None to not have Oracle Web Cache cache documents that use session information contained within a cookie or embedded in a URL as a parameter.

    Select Apply the following to have Oracle Web Cache cache documents with session information, and then select the required session definitions. If you do not see the session these documents require, choose Create A New Rule to create a new rule.

    Note: Session-related caching rules are also required for pages that use personalized attributes.

    See Also: "Configuring Rules for Pages with Session Tracking" for further information about creating session-related caching rules

    Personalized Pages

    Select No to cache documents with personalized attributes or session-encoded URLs.

    Select Yes to cache documents with personalized content, and then select one of the following options:

    • pages do not contain HREFs that are session encoded URLs to cache substitution instructions for only personalized attributes

    • pages contain HREFs that are session encoded URLs to cache substitution instructions for both personalized attributes and session-encoded URLs

    Important: To use the personalized attribute feature, enclose the personalized attribute information with the <!-- WEBCACHETAG> and the <!-- WEBCACHEEND--> HTML tags.

    See Also: "Configuring Rules for Personalized Pages" for further information about these tags

    Note: For every personalized attribute that a page uses, you must select the corresponding session-related caching rule defined for that attribute in the Session-Related Caching Rule row.

    HTTP Error Caching

    Enter the HTTP errors codes you want Oracle Web Cache to cache. If you enter multiple codes, use a comma to separate them. If there is a problem on the application Web servers that will remain unresolved, you can cache the error until the problem is resolved. Once the problem is resolved, you should invalidate the cached HTTP errors.

    See Also: "Invalidating Documents in the Cache"

    Need Compression

    Select to compress the documents upon insertion into the cache. If a document retrieved from the application Web server already contains a Content-Encoding header, which is typically used to denote compression, Oracle Web Cache will not compress it.

  7. Choose Submit.

  8. Repeat Steps 3 through 7 for each cacheability rule.

  9. In the Cacheability Rules page, order the rules by their priority. Select a cacheability rule and choose Move Up or Move Down to order the rules. Higher priority rules are processed first.

  10. Apply changes and restart Oracle Web Cache:

    1. In the Oracle Web Cache main window, choose Apply Changes.

    1. In the navigator pane, select Administering Oracle Web Cache > Web Cache Operations.

      The Oracle Web Cache Operations page appears in the right pane.

    2. In the Oracle Web Cache Operations page, choose Stop and then Start to restart Oracle Web Cache.

Configuring Expiration Rules

You can create rules for when to expire documents in the cache. In addition, you can specify how long documents can reside in the cache once they have expired. When a document expires, it is either immediately invalidated or invalidated based on when the application Web servers can refresh them.

To create expiration rules:

  1. Start Oracle Web Cache Manager.

    See Also:

    "Starting Oracle Web Cache Manager" 

  2. In the navigator pane, select Administering Web Sites > Caching Rules > Expiration Rules.

    The Expiration Rules page appears in the right pane.

  3. In the Expiration Rules page, choose Add.

    The Create Expiration Rule dialog box appears.

  4. In the Expire section, specify when to expire documents by selecting one of the following options. While the first two options enable you to set expiration for Oracle Web Cache-specific rules, the third option recognizes the expiration policy established for the documents already programmed with an HTTP Expires header.

    Expire <time> after cache entry

    Select this option to base expiration on when the documents entered the cache. Enter the number of seconds to expire the documents.

    Expire <time> after document creation

    Select this option to base expiration on when the documents were created. Enter the number of seconds to expire the documents.

    Expires as per HTTP Expires header

    Select this option to respect the HTTP Expires header. This is the default. In order to utilize this option, documents must be programmed to use the HTTP Expires header.

  5. In the After Expiration section, specify how you want Oracle Web Cache to process documents once they have expired.

    Remove immediately

    Select this option to have Oracle Web Cache mark documents as invalid and then refresh them immediately with updated content from the application Web servers.

    Refresh on demand as application Web server capacity permits AND no later than <time> after expiration

    Select this option to have Oracle Web Cache mark documents as invalid and then refresh them based on application Web server capacity. Enter the maximum time in which the documents can reside in the cache.

    Optionally, select a validity level for the documents after they expire. Validity determines how long Oracle Web Cache will serve documents stale from the cache before marking them as invalid.

    The validity level ranges from 1 (for the least valid) to 9 (for the most valid). The higher the validity level, the longer Oracle Web Cache will serve these documents stale from the cache before marking them as invalid. For documents with lower validity levels, Oracle Web Cache will serve these documents stale for a short amount of time before marking them as invalid.


    Note:

    Performance assurance heuristics apply when you configure documents to be refreshed based on when the application Web servers can refresh them; performance assurance heuristics do not apply when documents are immediately removed. 


  6. Choose Submit.

  7. Repeat Steps 3 through 6 for each expiration rule.

  8. In the Expiration Rules page, choose the newly-create rule, and choose Change URL Association.

    The Change Policy-URL Association dialog box appears.

  9. Select a URL from the right list, and then choose the Make Association button. The selected URL moves to the left list.

  10. Apply changes and restart Oracle Web Cache:

    1. In the Oracle Web Cache main window, choose Apply Changes.

    1. In the navigator pane, select Administering Oracle Web Cache > Web Cache Operations.

      The Oracle Web Cache Operations page appears in the right pane.

    2. In the Oracle Web Cache Operations page, choose Stop and then Start to restart Oracle Web Cache.

Configuring Rules for Multi-Version Documents Containing Cookies

See Also:

"Multiple Versions of the Same URL" for an overview and an example scenario 

You can specify which cookies whose values Oracle Web Cache will use to cache and identify multiple-version URLs.

To specify cookie values for multiple-version URLs:

  1. Start Oracle Web Cache Manager.

    See Also:

    "Starting Oracle Web Cache Manager" 

  2. In the navigator pane, select Administering Web Sites > Caching Rules > Multiple Documents with Same URL by Cookies.

    The Multiversion URLs - Cookies page appears in the right pane.

  3. In the Multiversion URLs - Cookies page, choose Create.

    The Edit/Create Multiple Documents with Same URL by Cookies Rule dialog box appears.

  4. In the Cookie Name field, enter the name of the cookie.

  5. Choose Yes in the Also cache documents whose requests do not contain this cookie? prompt to cache versions of the URL that do not use this cookie. This option enables you to serve documents from the cache for browser requests that do not use this cookie's value.

    Choose No to not cache versions of documents that do not use this cookie's value.

  6. Choose Change URL Association.

    The Change Policy-URL Association dialog box appears.

  7. Select a URL from the right list, and then choose the Make Association button. The selected URL moves to the left list.

  8. In the Edit/Create Multiple Documents with Same URL by Cookies Rule dialog box, choose Submit.

  9. Repeat Steps 3 through 8 for each rule.

  10. Apply changes and restart Oracle Web Cache:

    1. In the Oracle Web Cache main window, choose Apply Changes.

    1. In the navigator pane, select Administering Oracle Web Cache > Web Cache Operations.

      The Oracle Web Cache Operations page appears in the right pane.

    2. In the Oracle Web Cache Operations page, choose Stop and then Start to restart Oracle Web Cache.

Configuring Rules for Multi-Version Documents Containing HTTP Request Headers

See Also:

"Multiple Versions of the Same URL" for an overview and an example scenario 

You can specify which HTTP request headers whose values Oracle Web Cache will use to cache and identify multiple-version URLs. If a browser request passes a URL with one of the headers defined, then Oracle Web Cache serves the document from its cache.

To specify HTTP request headers for multiple-version documents, select one of the headers in the Multiple Documents with Same URL by Other Headers in the Edit/Create Cacheability Rule dialog box.

See Also:

"Configuring Cacheability Rules" 

Configuring Rules for Personalized Pages

You can specify cacheability rules for personalized pages that use personalized attributes or session-encoded URLs.

Personalized attributes are often in the form of "Hello, <Name>" or "Name". You can configure Oracle Web Cache to cache the instructions for substituting values for personalized attributes based on the information contained within a cookie or the embedded URL parameter.

Session-encoded URLs enable Web sites to keep track of user sessions through session information contained within <A HREF=...> HTML tags. Oracle Web Cache can cache the instructions for replacing session information for one user with another based on the personal information contained within a cookie or as an embedded URL parameter.

See Also:

 

To create rules for personalized pages:

  1. Start Oracle Web Cache Manager.

    See Also:

    "Starting Oracle Web Cache Manager" 

  2. For those pages with personalized attributes, create an attribute definition:

    1. In the navigator pane, select Administering Web Sites > Session Management > Personalized Pages > Session/Personalized Attribute Definitions.

      The Session/Personalized Attribute Definitions page appears in the right pane.

    1. In the Session/Personalized Attribute Definitions page, choose Add.

      The Edit/Create Session/Personalized Attribute Definition dialog box appears.

    2. In the Session Name field, enter an easy-to-remember unique name for the attribute. For example, if the attribute is for a personalized greeting that uses the first name, you could enter first_name01 for the session name.

    3. Enter the cookie name in the Cookie Name field and/or the embedded URL parameter in the URL Parameter field.

    4. Choose Submit.

    5. Configure the pages that use personalized attributes with the
      <!-- WEBCACHETAG>personalized attribute information
      <!-- WEBCACHEEND--> HTML tags as follows:

       <!-- WEBCACHETAG="session_name"-->
      personalized text
      <!-- WEBCACHEEND-->
      
      

      Ensure both tags have a space after <!--.

  3. Create a cacheability rule for the personalized pages, following the steps in "Configuring Cacheability Rules". In Step 6 of the procedure, ensure these steps are followed:

    1. For every personalized attribute that a page uses, select the corresponding session-related caching rule defined for that attribute in the Session-Related Caching Rule row. If you do not see the session these documents require, choose Create A New Rule to create a new rule.

    1. Select Yes in the Personalized Pages row of the Edit/Create Cacheability Rule dialog box, and then select one of the following options:

      • pages do not contain HREFs that are session encoded URLs to cache substitution instructions for only personalized attributes

      • pages contain HREFs that are session encoded URLs to cache substitution instructions for both personalized attributes and session-encoded URLs

  4. Apply changes and restart Oracle Web Cache:

    1. In the Oracle Web Cache main window, choose Apply Changes.

    1. In the navigator pane, select Administering Oracle Web Cache > Web Cache Operations.

      The Oracle Web Cache Operations page appears in the right pane.

    2. In the Oracle Web Cache Operations page, choose Stop and then Start to restart Oracle Web Cache.

Example: Personalized Page Configuration

To understand how to cache personalized content, consider the HTML page monthly.htm in Figure 6-1.

Figure 6-1 monthly.htm


Text description of personaa.gif follows.
Text description of the illustration personaa.gif

October is personalized content that can be substituted with other values.

The page has a URL of monthly.htm?Month=month., where Month is an embedded URL parameter.

The following steps were performed to cache monthly.htm and its personalized content.

  1. A personalized attribute of TestMonth was mapped to the embedded URL parameter Month in the Edit/Create Session/Personalized Attribute Definition dialog box.

    Figure 6-2 Edit/Create Session/Personalized Attribute Definition Dialog Box


    Text description of personal.gif follows.
    Text description of the illustration personal.gif
  2. A session-related caching rule was created that uses the embedded URL parameter Month in the Add Session Related Caching Rule dialog box.

    Figure 6-3 Add Session Related Caching Rule Dialog Box


    Text description of personab.gif follows.
    Text description of the illustration personab.gif

    See Also:

    "Configuring Rules for Pages with Session Tracking" for more information about creating session-related caching rules 

  3. The <!-- WEBCACHETAG> and <!-- WEBCACHEEND--> HTML tags were added to monthly.htm.

    Current Month is:
    <!-- WEBCACHETAG="TestMonth"-->October<!-- WEBCACHEEND-->
    
    
  4. A cacheability rule is created for monthly.htm in the Create Cacheability Rules dialog box

    1. In the Session-Related Caching Rule row, the session-related caching rule for the embedded URL Month was chosen.

    1. In the Personalized Pages row, Yes and pages contain HREFs that are session encoded URLs are chosen to cache substitution instructions for both personalized attributes and session-encoded URLs.

      Figure 6-4 Create Cacheability Rule Dialog Box


      Text description of cache5.gif follows
      Text description of the illustration cache5.gif
  5. The configuration changes are applied:

    1. In the Oracle Web Cache main window, Apply Changes is chosen.

    1. In the Oracle Web Cache Operations page, Oracle Web Cache is stopped and then restarted.

To verify that Oracle Web Cache was caching monthly.htm, requests for monthly.htm were sent to Oracle Web Cache:

  1. An initial request for monthly.htm at URL monthly.htm?Month=January was requested. Because the initial request was forwarded by Oracle Web Cache to the application Web server, the value October was required for the Month parameter. This initial request inserted monthly.htm into the cache.

  2. A subsequent request for monthly.htm was sent to URL monthly.htm?Month=January.

    Oracle Web Cache substituted October with the value of January.

    Figure 6-5 monthly.htm When Cached


    Text description of personac.gif follows.
    Text description of the illustration personac.gif

Configuring Rules for Pages with Session Tracking

See Also:

"Session Tracking" for an overview  

You can configure cacheability rules for pages that use session ID information, enabling Oracle Web Cache to serve the same page for multiple user sessions. Here's how caching of session tracking pages works:

To create caching rules for pages that support session tracking:

  1. Start Oracle Web Cache Manager.

    See Also:

    "Starting Oracle Web Cache Manager" 

  2. In the navigator pane, select Administering Web Sites > Caching Rules > Session-Related Caching Rules.

    The Session Related Caching Rules page appears in the right pane.

  3. In the Session Related Caching Rules page, choose Add.

    The Add Session Related Caching Rule dialog box appears.

  4. From the Please select a session list, select a session and skip to Step 6.

    If the sessions listed do not contain the definition you require, choose Create A New Session Definition to create a new session definition. The Edit/Create Session/Personalized Attribute Definitions dialog box appears. Continue to Step 5.

  5. Create a session definition in the Edit/Create Session/Personalized Attribute Definitions dialog box:

    1. In the Session Name field, enter an easy-to-remember unique name for the attribute.

    1. Enter the cookie name in the Cookie Name field and/or the embedded URL parameter in the URL Parameter field.

    2. Choose Submit.

  6. For the Cache documents whose requests contain this session? prompt in the Add Session Related Caching Rule, choose either YES or NO:

    • Choose YES to cache versions of documents that use the session information associated with the selected session.

    • Choose NO to not cache versions of documents that use the session information.

  7. For the Cache documents whose requests do not contain this session? prompt, choose either YES or NO:

    • Choose YES to cache versions of documents that do not use the session information. This enables Oracle Web Cache to serve documents from the cache for Web browser requests without the session information.

    • Choose NO to not cache versions of documents that do not use the session information.

  8. Choose Change URL Association to associate the rule with a URL.

    The Change Policy-URL Association dialog box appears.

  9. Select a URL from the right list, and then choose the Make Association button. The selected URL moves to the left list.

  10. In the Add Session Related Caching Rule dialog box, choose Submit.

  11. Repeat Steps 3 through 10 for each rule.

  12. Apply changes and restart Oracle Web Cache:

    1. In the Oracle Web Cache main window, choose Apply Changes.

    1. In the navigator pane, select Administering Oracle Web Cache > Web Cache Operations.

      The Oracle Web Cache Operations page appears in the right pane.

    2. In the Oracle Web Cache Operations page, choose Stop and then Start to restart Oracle Web Cache.


Go to previous page Go to next page
Oracle
Copyright © 1996-2000 Oracle Corporation.

All Rights Reserved.

Library

Service

Contents

Index