Cache Document Step

Use the Cache Document step to perform an input/output (I/O) operation (such as reading a file or making an HTTP request) and cache the resulting document in the memory buffer.

Cache Document Customizer Window
Note

Because the Cache Document step can use a great deal of memory, you should use it with caution.

The I/O operation is specified by the document defined in a preceding step (such as Create File Document or Create URL Document) or by a document expression that contains a hard-coded document. When the Create File Document or Create URL Document step executes, it creates the document variable but does not send the URL request or access the file system.

The actual I/O operation occurs when another step (such as Send Response or Write Document) references the document. The Cache Document step allows you to complete the I/O operation before executing any subsequent steps.

Example shows script pseudocode demonstrating how you can use the Cache Document step.

doc=Create URL Document(“http://mybank.money.com/debit?amount=500”)
doc=Cache Document(doc)
. . . 
SendResponse(doc)

In the above example, the Cache step makes the HTTP request to mybank.money.com. Without the Cache step, the I/O does not occur until the Send Response step executes.

The following table describes the properties of the Cache Document customizer window:

Property

Description

Document

The document you want to obtain and cache from the Document variable drop-down list.

Max Buffer Size (KB)

The maximum buffer size that you want to use.

Assign this value carefully because the buffer size you assign may affect system performance. The Maximum Buffer Size can be set to 0 to request everything to be cached in memory. If the document is bigger than the specified size, it will be truncated.

To use the Cache Document customizer window to cache a document in the memory buffer, perform the following procedure:

Procedure

 Command or ActionPurpose
Step 1

From the Document drop-down menu, choose the variable that stores the document value.

Step 2

In the Maximum Buffer Size (KB) field, enter a value directly or take one of the following actions:

  • From the Maximum Buffer Size (KB) drop-down menu, choose the variable that stores the maximum buffer size value.

  • Click the Expression Editor (...) button and enter an expression that specifies the maximum buffer size value.

Step 3

Click OK.

The Cache Document customizer window closes, and the maximum buffer size variable appears next to the Cache Document step icon in the Design pane of the Cisco Unified CCX  Editor.