Oracle Web Cache Administration and Deployment Guide
Release 1.0.2.3

Part Number A86722-03

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 URLs containing /cec/cstage?ecaction=ecpassthru to be cached except for /cec/cstage?ecaction=ecpassthru2, you would enter the rules in the following order:

  1. ^/cec/cstage\?ecaction=ecpassthru2 (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=ecpassthru2.

Examples of content that administrators would typically declare non-cacheable include update transactions, shopping cart views, personal account views, and so forth. One of the easiest ways to set up cacheability rules in Oracle Web Cache is either to first specify the non-cacheable content, and then use a broad "catch-all" rule for the cacheable content, or to first specify the cacheable content followed by a non-cacheable catch-all rule. In practice, cacheable and non-cacheable rules can be interspersed.

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 store only pages with static content.

Cacheability Rule Syntax

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 

Default Cacheability Rules

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

Table 6-2 Regular Expression Examples

URL Expression  Cache/Don't Cache  Description 

\.pdf$ 

Don't Cache 

Instructs Oracle Web Cache to not cache files ending in .pdf 

\.html$ 

Cache 

Instructs Oracle Web Cache to cache all files ending in .htm and .html 


Note:

Oracle Web Cache cannot cache HTTP multi-part responses to HTTP Range requests. If the application Web servers that Oracle Web Cache sends HTTP requests to return certain documents in multi-part format, configure these documents as non-cacheable. For example, certain browsers send Range requests for PDF documents; therefore, the cacheability rules for all PDF documents should be set non-cacheable. 


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 no rules exist. If rules already exist, select a rule, and then choose Insert Above or Insert Below.

    The Create Cacheability Rule or 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 of the URL 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 columns 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 category 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 Multiple-Version URLs 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 session 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.

    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 creating rules for personalized pages

    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 Manager 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.

Cacheability Rule Example

Figure 6-1 illustrates how an administrator might set up cacheability rules for a catalog built on Oracle iStore technology, which enables e-merchants to design, build, and publish their stores on the World Wide Web.

Figure 6-1 Cacheability Rules Example


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

The rules are described in Table 6-3.

Table 6-3 Regular Expression Examples

Priority Order  URL Expression  Cache/Don't Cache  GET/POST Caching  Description 

1  

template=walkin\.en\.htm 

Cache 

GET, GET with query string 

Caches the home page, including personalized information 

2 

ecpassthru2 

Don't Cache 

Not Applicable 

Does not cache this template, because it contains customized user account information 

ecpassthru 

Cache 

GET, GET with query string 

Caches this template, because it does not contain customized content. 

\.jpe?g$ 

Cache 

GET, GET with query string 

Caches all JPEG images 

\.gif$ 

Cache 

GET, GET with query string 

Caches all GIF images 

\.html?$ 

Cache 

GET, GET with query string 

Caches all pages ending in .htm and .html 

ecprditmsearch 

Cache 

GET, GET with query string 

Caches the search results 

eclogout 

Don't Cache 

Not Applicable 

Does not cache logout results 

eccartview 

Don't Cache 

Not Applicable 

Does not cache the shopping cart  

10 

ecacctroot 

Don't Cache 

Not Applicable 

Does not cache the account view 

11 

\.pdf$ 

Don't Cache 

Not Applicable 

Does not cache pages ending in .pdf 

12 

.* 

Cache 

GET, GET with query string 

Caches everything else in the Web site 


Note:

Implementations of Oracle iStore can be customized. Therefore, these cacheability rules will not apply in all Oracle iStore deployments. 


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 > Cacheability 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 remove them immediately. A document is refreshed from the application Web server when the cache receives the next request for it.

    Note: This is equivalent to a validity level of 0.

    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 serves documents stale from the cache before marking them as invalid. Oracle Web Cache serves documents with a low validity level 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 Manager 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 Multiple-Version URLs Containing Cookies

See Also:

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

You can specify which category 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 with the Same URL by Cookies page appears in the right pane.

  3. In the Multiversion URLs with the Same URL by 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 Manager 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 Multiple-Version URLs 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 column of 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". Personalized attributes can come in other forms, such as icons, addresses, or shopping cart snippets. 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. As necessary, create attribute definition(s) for those pages with personalized attributes and session definition(s) for those pages with session-encoded URLs:

    1. In the navigator pane, select Administering Web Sites > Session Management > 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 or session.

      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.

      If you enter both a cookie name and an embedded URL parameter, keep in mind that both must support the same personalized attribute or session substitution. If they support different substitutions, create separate personalized definitions. You can specify up to 20 definitions for each page.


      Note:

      Ensure that the size of cookies is not greater than 3KB.  


    4. Choose Submit.

    5. Configure the pages that use personalized attributes with the <!-- WEBCACHETAG> and<!-- WEBCACHEEND--> as follows:

       <!-- WEBCACHETAG="personalized_attribute"-->
      personalized attribute HTML segment
      <!-- WEBCACHEEND-->
      
      

      The personalized attribute information can be any valid HTML segment with beginning (<tag>) and ending (</tag>) HTML tags.

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

  3. Create a cacheability rule for the personalized pages, as described in "Configuring Cacheability Rules". In Step 6 of the procedure, select Yes in the Personalized Pages row of the Edit/Create Cacheability Rule dialog box, and then select one of the following options:

  4. Apply changes and restart Oracle Web Cache:

    1. In the Oracle Web Cache Manager 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-2.

Figure 6-2 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-3 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-4 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-5 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 Manager 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=October 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-6 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: When a user first accesses a Web site that uses session IDs, the application Web server assigns a unique session ID to the user. Session IDs are contained within a cookie or embedded in the URL as a parameter. If you configure Oracle Web Cache to cache the pages that use a session ID, subsequent requests that pass the cookie or embedded URL parameter are served from the cache.

Note that Oracle Web Cache ignores the values of session cookies. The response from the application Web server is cached, even if the response session cookie value does not match the request session cookie value. If you do not want the response cached when there is a value mismatch, then modify the application to instead send a non-200 status code as the response.

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 > Cacheability 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 Create or 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 Session to create a new session definition. The Edit/Create Session/Personalized Attribute Definition dialog box appears. Continue to Step 5.

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

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

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

      If you enter both a cookie name and an embedded URL parameter, keep in mind that both must be used to support the same session. If they support different sessions, create separate session definitions. You can specify up to 20 definitions for each page.


      Note:

      When a session cookie expires, the browser removes the cookie and subsequent requests for the document are directed to the application Web server. To avoid pages being served past the browser session expiration time, ensure that the session cookie expires before the application Web server expires the browser session.  


    2. Choose Submit.

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

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

    • Select 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:

  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 Manager 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-2001 Oracle Corporation.

All Rights Reserved.

Library

Service

Contents

Index