Invalidation Examples Format of Invalidation Requests for Out-of-Band and ESI Inline Mechanisms

Invalidating Content 7-13 DOCTYPE INVALIDATION SYSTEM internal:WCSinvalidation.dtd INVALIDATION VERSION=WCS-1.1 OBJECT ADVANCEDSELECTOR URIPREFIX=http:www.company.comcontacts URIEXP=contactscontacts\.html ACTION REMOVALTTL=0 OBJECT INVALIDATION The ADVANCEDSELECTOR element uses the URIPREFIX attribute. This attribute is used to traverse the directory structure. The quicker invalidation reaches the right tree level, the quicker the invalidation process is done. The request with the BASICSELECTOR element is the more efficient of the two examples because there is no directory structure traversal involved.

7.5.5.2 Example: Invalidating Multiple Objects

The following request invalidates two different objects, summary.jsp and summary.gif. In addition, the request provides the comments summary.jsp and summary.gif to be included in the invalidation result and event log. ?xml version=1.0? DOCTYPE INVALIDATION SYSTEM internal:WCSinvalidation.dtd INVALIDATION VERSION=WCS-1.1 OBJECT ADVANCEDSELECTOR URIPREFIX=globalsales URIEXP=summary.jsp\?year=2001 HOST=www.company.com:80 COOKIE NAME=group VALUE=asia ADVANCEDSELECTOR ACTION INFO VALUE=summary.jsp OBJECT OBJECT ADVANCEDSELECTOR URIPREFIX=image URIEXP=summary.\.gif HOST=www.company.com:80 INFO VALUE=summary.gif ACTION OBJECT INVALIDATION Invalidation response: ?xml version=1.0? DOCTYPE INVALIDATIONRESULT SYSTEM internal:WCSinvalidation.dtd INVALIDATIONRESULT VERSION=WCS-1.1 OBJECTRESULT ADVANCEDSELECTOR URIPREFIX=globalsales URIEXP=summary.jsp\?year=2001 HOST=www.company.com:80 COOKIE NAME=group VALUE=asia ADVANCEDSELECTOR RESULT ID=1 STATUS=SUCCESS NUMINV=2 INFO VALUE=summary.jsp OBJECTRESULT OBJECTRESULT ADVANCEDSELECTOR URIPREFIX=image URIEXP=summary.\.gif HOST=www.company.com:80 ADVANCEDSELECTOR RESULT ID=2 STATUS=SUCCESS NUMINV=14 INFO VALUE=summary.gif OBJECTRESULT INVALIDATIONRESULT 7-14 Oracle Fusion Middleware Administrators Guide for Oracle Web Cache The following messages are written to the event log: [15Oct2008:19:26:46 +0000] [notification 11748] [invalidation] [ecid: 21085932167,0] Invalidation with INFO summary.jsp has returned with status SUCCESS; number of objects invalidated: 2. . . . [15Oct2008:19:26:46 +0000] [notification 11748] [invalidation] [ecid: 21085932167,0] Invalidation with INFO summary.gif has returned with status SUCCESS; number of objects invalidated: 14.

7.5.5.3 Example: Invalidating a Subtree of Objects

The following request invalidates all objects under the images directory: ?xml version=1.0? DOCTYPE INVALIDATION SYSTEM internal:WCSinvalidation.dtd INVALIDATION VERSION=WCS-1.1 OBJECT ADVANCEDSELECTOR URIPREFIX=images HOST=www.company.com:80 ACTION REMOVALTTL=0 OBJECT INVALIDATION Invalidation response: ?xml version=1.0? DOCTYPE INVALIDATIONRESULT SYSTEM internal:WCSinvalidation.dtd INVALIDATIONRESULT VERSION=WCS-1.1 OBJECTRESULT ADVANCEDSELECTOR URIPREFIX=images HOST=www.company.com:80 RESULT ID=1 STATUS=SUCCESS NUMINV=125 OBJECTRESULT INVALIDATIONRESULT The following request invalidates all objects under the contacts directory whose file names end in .html and uses cookie name cust with a value of oracle: ?xml version=1.0? DOCTYPE INVALIDATION SYSTEM internal:WCSinvalidation.dtd INVALIDATION VERSION=WCS-1.1 OBJECT ADVANCEDSELECTOR URIPREFIX=contacts URIEXP=\.html HOST=www.company.com:80 COOKIE NAME=cust VALUE=oracle ADVANCEDSELECTOR ACTION REMOVALTTL=0 OBJECT INVALIDATION Invalidation response: ?xml version=1.0? DOCTYPE INVALIDATIONRESULT SYSTEM internal:WCSinvalidation.dtd INVALIDATIONRESULT VERSION=WCS-1.1 OBJECTRESULT ADVANCEDSELECTOR URIPREFIX=contacts URIEXP=\.html HOST=www.company.com:80 COOKIE NAME=cust VALUE=oracle ADVANCEDSELECTOR Invalidating Content 7-15 RESULT ID=1 STATUS=SUCCESS NUMINV=45 OBJECTRESULT INVALIDATIONRESULT

7.5.5.4 Example: Invalidating All Objects for a Web Site

The following request invalidates all objects under . ?xml version=1.0? DOCTYPE INVALIDATION SYSTEM internal:WCSinvalidation.dtd INVALIDATION VERSION=WCS-1.1 OBJECT ADVANCEDSELECTOR URIPREFIX= HOST=www.company.com:80 ACTION REMOVALTTL=0 OBJECT INVALIDATION Invalidation response: ?xml version=1.0? DOCTYPE INVALIDATIONRESULT SYSTEM internal:WCSinvalidation.dtd INVALIDATIONRESULT VERSION=WCS-1.1 OBJECTRESULT ADVANCEDSELECTOR URIPREFIX= HOST=www.company.com:80 RESULT ID=1 STATUS=SUCCESS NUMINV=17 OBJECTRESULT INVALIDATIONRESULT

7.5.5.5 Example: Invalidating Objects Using Prefix Matching

To better understand the relationship of the URIPREFIX and URIEXP attributes, consider the examples that follow. The following syntax invalidates sample.gif files within the ceccstagegraphic directories: ADVANCEDSELECTOR URIPREFIX=ceccstage URIEXP=graphic.sample\.gif ADVANCEDSELECTOR Note that . in graphic.sample\.gif are regular expression characters that match all directories starting with graphic. The . in sample\.gif is escaped for a literal interpretation. The following syntax instructs Oracle Web Cache to locate a directory named graphic: ADVANCEDSELECTOR URIPREFIX=ceccstagegraphic URIEXP=sample\.gif HOST=www.company.com:80 ADVANCEDSELECTOR The following syntax invalidates objects with a URI containing ceccstage?ecaction=viewitem: ADVANCEDSELECTOR URIPREFIX=cec URIEXP=cstage\?ecaction=viewitem HOST=www.company.com:80 ADVANCEDSELECTOR Note that ? is escaped with a backslash. URLs such as ceccstage?ecaction=viewitemzip=94405 and ceccstage?ecaction=viewitemzip=94305 match and are invalidated, but 7-16 Oracle Fusion Middleware Administrators Guide for Oracle Web Cache usaceccstage?ecaction=viewitemzip=94209 does not match and is not invalidated.

7.5.5.6 Example: Invalidating Objects Using Substring and Query String Matching

The following request invalidates all objects under matching the substrings post and htm. In addition, the request provides the comment remove-htm-under-all-post-dir to be included in the invalidation result and event log. ?xml version=1.0? DOCTYPE INVALIDATION SYSTEM internal:WCSinvalidation.dtd INVALIDATION VERSION=WCS-1.1 OBJECT ADVANCEDSELECTOR URIPREFIX= HOST=www.company.com:80 OTHER NAME=URI TYPE=SUBSTRING VALUE=post OTHER NAME=URI TYPE=SUBSTRING VALUE=htm ADVANCEDSELECTOR ACTION REMOVALTTL=0 INFO VALUE=remove-htm-under-all-post-dir OBJECT INVALIDATION Invalidation response: ?xml version=1.0? DOCTYPE INVALIDATIONRESULT SYSTEM internal:WCSinvalidation.dtd INVALIDATIONRESULT VERSION=WCS-1.1 OBJECTRESULT ADVANCEDSELECTOR URIPREFIX= HOST=www.company.com:80 OTHER NAME=URI TYPE=SUBSTRING VALUE=post OTHER NAME=URI TYPE=SUBSTRING VALUE=htm RESULT ID=1 STATUS=SUCCESS NUMINV=52 INFO VALUE=remove-htm-under-all-post-dir OBJECTRESULT INVALIDATIONRESULT The following message writes to the event log: [15Oct2008:19:26:46 +0000] [notification 11748] [invalidation] [ecid: 21085932167,0] Invalidation with INFO remove-htm-under-all-post-dir has returned with status SUCCESS; number of objects invalidated: 52. The following request invalidates all objects under corporateasp, matching the substring view_building.asp and the embedded URL parameter value pairs of building=8 and floor=10. In addition, the request provides the comment remove-view-building8-10th-floor to be included in the invalidation result and event log. ?xml version=1.0? DOCTYPE INVALIDATION SYSTEM internal:WCSinvalidation.dtd INVALIDATION VERSION=WCS-1.1 OBJECT ADVANCEDSELECTOR URIPREFIX=corporateasp HOST=www.company.com:80 OTHER NAME=URI TYPE=SUBSTRING VALUE=view_building.asp OTHER NAME=QUERYSTRING_PARAMETER TYPE=SUBSTRING VALUE=building=8 OTHER NAME=QUERYSTRING_PARAMETER TYPE=SUBSTRING VALUE=floor=10 ADVANCEDSELECTOR ACTION REMOVALTTL=0 Invalidating Content 7-17 INFO VALUE=remove-view-building8-10th-floor OBJECT INVALIDATION Invalidation response: ?xml version=1.0? DOCTYPE INVALIDATIONRESULT SYSTEM internal:WCSinvalidation.dtd INVALIDATIONRESULT VERSION=WCS-1.1 OBJECTRESULT ADVANCEDSELECTOR URIPREFIX= HOST=www.company.com:80 OTHER NAME=URI TYPE=SUBSTRING VALUE=view_building.asp OTHER NAME=QUERYSTRING_PARAMETER TYPE=SUBSTRING VALUE=building=8 OTHER NAME=QUERYSTRING_PARAMETER TYPE=SUBSTRING VALUE=floor=10 RESULT ID=1 STATUS=SUCCESS NUMINV=3 INFO VALUE=remove-view-building8-10th-floor OBJECTRESULT INVALIDATIONRESULT The following message writes to the event log: [15Oct2008:19:26:46 +0000] [notification 11748] [invalidation] [ecid: 21085932 167,0] Invalidation with INFO remove-view-building8-10th-floor has returned with status SUCCESS; number of objects invalidated: 3. See Section 7.7.2.2 to optimize invalidations using QUERYSTRING_PARAMETER.

7.5.5.7 Example: Invalidating Objects Using Search Key Matching

The following request invalidates all objects under plspublicuser, matching the following: ■ Substring plspublicuserMODULE.wwpob_page.show ■ HTTP request header x-oracle-cache-user and value PUBLICUSER ■ Surrogate-Key response-header field containing a search key of template_ id=33,31345. ?xml version=1.0? DOCTYPE INVALIDATION SYSTEM internal:WCSinvalidation.dtd INVALIDATION VERSION=WCS-1.1 OBJECT ADVANCEDSELECTOR URIPREFIX=plspublicuser HOST=www.company.com:80 METHOD=POST OTHER NAME=SEARCHKEY VALUE=template_id=33,31345 HEADER NAME=x-oracle-cache-user VALUE=PUBLICUSER OTHER NAME=URI TYPE=SUBSTRING VALUE=plspublicuserMODULE.wwpob_page.show ADVANCEDSELECTOR ACTION REMOVALTTL=0 OBJECT INVALIDATION Invalidation response: ?xml version=1.0? DOCTYPE INVALIDATIONRESULT SYSTEM internal:WCSinvalidation.dtd INVALIDATIONRESULT VERSION=WCS-1.1 OBJECTRESULT ADVANCEDSELECTOR URIPREFIX=plspublicuser HOST=www.company.com:80 METHOD=POST OTHER NAME=SEARCHKEY VALUE=template_id=33,31345 7-18 Oracle Fusion Middleware Administrators Guide for Oracle Web Cache HEADER NAME=x-oracle-cache-user VALUE=PUBLICUSER OTHER NAME=URI TYPE=SUBSTRING VALUE=plspublicuserMODULE.wwpob_page.show RESULT ID=1 STATUS=SUCCESS NUMINV=3 OBJECTRESULT INVALIDATIONRESULT

7.5.5.8 Example: Propagating Invalidation Requests Throughout a Cache Cluster

In a cache cluster, you can enable or disable the propagation of invalidation requests to all cluster members in Fusion Middleware Control and Oracle Web Cache Manager, as described in Section 3.6.5 and Section 3.7.4 , respectively. You can override the setting by using a pair of namevalue attributes of the SYSTEMINFO element. If NAME is set to WCS_PROPAGATE and VALUE is set to TRUE, it overrides the setting specified in Fusion Middleware Control or Oracle Web Cache Manager. If NAME is set to WCS_PROPAGATE and VALUE is set to FALSE, it reads the setting specified in Fusion Middleware Control or Oracle Web Cache Manager. The following request invalidates the file imageslogo.gif and propagates the request to all cluster members. In this example, there are three cluster members: ?xml version=1.0? DOCTYPE INVALIDATION SYSTEM internal:WCSinvalidation.dtd INVALIDATION VERSION=WCS-1.1 SYSTEM SYSTEMINFO NAME=WCS_PROPAGATE VALUE=TRUE SYSTEM OBJECT BASICSELECTOR URI=web_cache_host_name:portimageslogo.gif ACTION OBJECT INVALIDATION Invalidation response: ?xml version=1.0? DOCTYPE INVALIDATIONRESULTDETAIL SYSTEM internal:WCSinvalidation.dtd INVALIDATIONRESULTDETAIL VERSION=WCS-1.1 INVALIDATIONRESULT VERSION=WCS-1.1 SYSTEM SYSTEMINFO NAME=WCS_CACHE_NAME VALUE=Cache_A SYSTEM OBJECTRESULT BASICSELECTOR URI=http:www.company.com:80imageslogo.gif RESULT ID=1 STATUS=SUCCESS NUMINV=1 OBJECTRESULT INVALIDATIONRESULT INVALIDATIONRESULT VERSION=WCS-1.1 SYSTEM SYSTEMINFO NAME=WCS_CACHE_NAME VALUE=Cache_B SYSTEM OBJECTRESULT BASICSELECTOR URI=http:www.company.com:80imageslogo.gif RESULT ID=1 STATUS=SUCCESS NUMINV=1 OBJECTRESULT INVALIDATIONRESULT INVALIDATIONRESULT VERSION=WCS-1.1 SYSTEM SYSTEMINFO NAME=WCS_CACHE_NAME VALUE=Cache_C SYSTEM Invalidating Content 7-19 OBJECTRESULT BASICSELECTOR URI=http:www.company.com:80imageslogo.gif RESULT ID=1 STATUS=SUCCESS NUMINV=1 OBJECTRESULT INVALIDATIONRESULT INVALIDATIONRESULTDETAIL

7.5.5.9 Example: Previewing Invalidation

The following request previews up to 50 objects ending in .htm: ?xml version=1.0? DOCTYPE INVALIDATIONPREVIEW SYSTEM internal:WCSinvalidation.dtd INVALIDATIONPREVIEW VERSION=WCS-1.1 STARTNUM=0 MAXNUM=50 ADVANCEDSELECTOR URIPREFIX=http:company-sun URIEXP=.\.htm ADVANCEDSELECTOR INVALIDATIONPREVIEW Invalidation response: ?xml version=1.0? DOCTYPE INVALIDATIONPREVIEWRESULT SYSTEM internal:WCSinvalidation.dtd INVALIDATIONPREVIEWRESULT VERSION=WCS-1.1 STATUS=SUCCESS STARTNUM=0 NUMURLS=2 TOTALNUMURLS=2 SYSTEM SYSTEMINFO NAME=WCS_CACHE_NAME VALUE=server-cache SYSTEM SELECTEDURL VALUE=company-sun:80index.htm SELECTEDURL VALUE=company-sun:80dtd.htm INVALIDATIONPREVIEWRESULT

7.6 About Search Keys in Invalidations

You can base invalidation on one or more search keys used in the Surrogate-Key response-header field of objects in the cache. The Surrogate-Key response-header field enables application developers to identify search key strings for a given response object. Search keys are strings that may not appear in the URL, cookies, or HTTP request headers of objects. The intent of the search keys is to provide another criteria for invalidation. In addition to the URL of objects, Oracle Web Cache administrators can base invalidation on one or more search keys used in the Surrogate-Key response-header field of objects in the cache. The Surrogate-Key response-header field supports the following syntax: Surrogate-Key: search-key=key key key ... Usage Notes ■ If search-key is specified in this header, then at least one search key value must be present. ■ Search key values must be enclosed within quotes . ■ Search key values can be of any format, such as key_value or key_ name =key_value. ■ The maximum number of allowed search keys is 20. ■ Space between search keys is optional. 7-20 Oracle Fusion Middleware Administrators Guide for Oracle Web Cache ■ The search keys must remain the same. Example Usage The following examples show valid Surrogate-Key fields. The first example shows one search key of template_id=33,31345, and the second example shows search keys of template_id=33,31345 and category. Surrogate-Key: search-key= template_id=33,31345 Surrogate-Key: search-key=template_id=33,31345 category The following examples show invalid Surrogate-Key fields. The first example shows one search key of 348 without an ending quote , and the second example shows search-key without any search key values. Surrogate-Key: search-key= template_id=348 Surrogate-Key: search-key= For more information about enabling search-key invalidation, see Section 7.9 .

7.7 Initiating Out-of-Band Invalidations

The following topics describe how to initiate out-of-band invalidations: ■ Section 7.7.1, Using Telnet to Send Invalidation Requests ■ Section 7.7.2, Using Oracle Web Cache Manager to Send Invalidation Requests ■ Section 7.7.3, Using Application Program Interfaces APIs for Automated Invalidation Requests ■ Section 7.7.4, Using Database Triggers for Automated Invalidation Requests ■ Section 7.7.5, Using Scripts for Automated Invalidations

7.7.1 Using Telnet to Send Invalidation Requests

When you send an invalidation request with an HTTP POST request, you specify the host name of Oracle Web Cache, the invalidation listening port number, and the invalidation request. For example, if you are using telnet, you send an invalidation request using the following procedure: 1. Connect to Oracle Web Cache at the invalidation listening port: telnet web_cache_host invalidation_port 2. Specify a POST message header and authenticate the invalidator account using Base64 encoding string with the following syntax: POST x-oracle-cache-invalidate http1.0|1 Authorization: BASIC base64 encoding of invalidator:invalidator_password content-length:bytes The following shows an example of the Authorization line: Authorization: BASIC aW52YWxpZGF0b3I6aW52YWxpZGF0b3I= In this example, aW52YWxpZGF0b3I6aW52YWxpZGF0b3I= is the invalidator user name and password invalidator:invalidator encoded. Invalidating Content 7-21 For more information, see: ■ http:www.rfc-editor.org for information about password Base64 encoding ■ readme.examples.htmlfor further information about using the EncodeBase64.java script to generate the Base64 string for invalidator:invalidator_password. This file is located in the following directories: UNIX ORACLE_HOMEwebcachedocs Windows ORACLE_HOME\webcachedocs ■ Section 5.2 for further information about changing the invalidation password 3. Enter one carriage return. 4. Send the invalidation request with XML syntax, as specified in Section 7.5 .

7.7.2 Using Oracle Web Cache Manager to Send Invalidation Requests

Oracle Web Cache Manager provides an easy-to-use interface for invalidating cached objects. The advantage of using this interface is that the administrator is isolated from the intricacies of the HTTP and XML formats, and consequently, there is less chance for error. The administrator need only specify which objects to invalidate and how how quickly those objects should be invalidated. Oracle Web Cache Manager enables you to send either basic invalidation request for invalidation one object, or an advanced invalidation request for multiple objects, as described in the following topics: ■ Section 7.7.2.1, Submitting Basic Invalidation Requests ■ Section 7.7.2.2, Submitting Advanced Invalidation Requests

7.7.2.1 Submitting Basic Invalidation Requests

To send a basic invalidation request using Oracle Web Cache Manager:

1. From Oracle Web Cache Manager, in the navigator frame, select Operations

Basic Content Invalidation. See Section 2.7.2 . The Basic Content Invalidation page appears in the right pane.

2. From the For Cache list, select a cache. The list displays multiple caches only if

you configured a cache cluster. If you configured the cluster to propagate Note: If you receive the following error when you submit invalidation requests from the Basic Content Invalidation or Advanced Content Invalidation pages, restart the cache or admin server processes. Internal error: cant connect to Oracle Web Cache Invalidation Listening Port If you change the property of an invalidation port, restart the cache server process. If you change the password for the administrator account in the Security page, restart the cache and admin server processes. Until you restart the cache server process for either configuration change, invalidation requests return the error. See Section 2.13 for restart instructions.