8.10 Configuring Caching Parameters

You can configure caching settings by using either the administration console or the CLI.

Configuring Caching Settings Using the Administration Console

To configure caching settings by using the administration console, do the following:

  1. Log in to the administration console, as described in Section 2.3.2, "Accessing the Administration Console."

  2. Click the Configurations button that is situated at the upper left corner of the page.

    A list of the available configurations is displayed.

  3. Select the configuration that you want to modify.

  4. In the navigation pane, select Advanced Settings.

    The Advanced Settings page is displayed.

  5. Go to the Cache section on the page.

  6. Specify the caching parameters that you want to change.

    On-screen help and prompts are provided for all of the parameters.

    When you change the value in a field or tab out of a text field that you changed, the Save button near the upper right corner of the page is enabled.

    At any time, you can discard the changes by clicking the Reset button.

  7. After making the required changes, click Save.

    • A message, confirming that the updated configuration was saved, is displayed in the Console Messages pane.

    • In addition, the Deployment Pending message is displayed at the top of the main pane. You can either deploy the updated configuration immediately by clicking Deploy Changes, or you can do so later after making further changes as described in Section 4.3, "Deploying a Configuration."

Configuring Virtual Server-Specific Caching Rules Using the Administration Console

To create virtual server-specific caching rules by using the administration console, do the following:

  1. Log in to the administration console, as described in Section 2.3.2, "Accessing the Administration Console."

  2. Click the Configurations button that is situated at the upper left corner of the page.

    A list of the available configurations is displayed.

  3. Select the configuration for which you want to create virtual server-specific caching rules.

  4. In the navigation pane, expand Virtual Servers, expand the name of the virtual server for which you want to create caching rules, and select Caching.

    The Caching page is displayed. It lists the caching rules that are currently defined for the virtual server, and indicates whether the rules are enabled.

    Creating a Caching Rule

    1. Click New Caching Rule.

      The New Cache Rule dialog box is displayed.

      In the Name field, enter a name for the new caching rule.

    2. Click Next.

      If this is the first caching rule for the virtual server, the New Caching Rule dialog box gives you the option to choose whether the rule should be applied to all requests. Select All Requests.

      If you wish to apply the rule to only those requests that satisfy a condition, create a new condition by selecting Create a new condition. In the condition builder, select a Variable/Function and an Operator from the respective drop-down lists and provide a value in the Value field.

      Select the and/or operator from the drop-down list when configuring multiple expressions. Similarly, use the Not operator when you want the route to be applied only when the given expression is not true.

      To enter a condition manually, click Cancel and then click Edit Manually. In the Condition field, specify the condition under which the caching rule should be applied. For information about building condition expressions, click the help button near the Condition field or see "Using Variables, Expressions, and String Interpolation" in the Oracle Traffic Director Configuration Files Reference.

    3. Click Next and then click Create Caching Rule.

      The caching rule that you just created is displayed on the Caching page.

      In addition, the Deployment Pending message is displayed at the top of the main pane. You can either deploy the updated configuration immediately by clicking Deploy Changes, or you can do so later after making further changes as described in Section 4.3, "Deploying a Configuration."

    Editing a Caching Rule

    To enable or disable a caching rule, or to change the settings of a rule, do the following:

    1. Click the Name of the caching rule that you want to edit.

      The Edit Cache Rule dialog box is displayed.

      Note:

      To access the condition builder to edit conditions, select Requests satisfying the condition and click Edit. The condition builder enables you to delete old expressions and add new ones.
    2. Specify the parameters that you want to change.

      On-screen help and prompts are provided for all of the parameters.

      For information about building condition expressions, click the help button near the Condition field or see "Using Variables, Expressions, and String Interpolation" in the Oracle Traffic Director Configuration Files Reference.

      When you change the value in a field or tab out of a text field that you changed, the Save button near the upper right corner of the page is enabled.

      At any time, you can discard the changes by clicking the Reset button.

    3. After making the required changes, click Save.

      A message, confirming that the updated configuration was saved, is displayed in the Console Messages pane.

      In addition, the Deployment Pending message is displayed at the top of the main pane. You can either deploy the updated configuration immediately by clicking Deploy Changes, or you can do so later after making further changes as described in Section 4.3, "Deploying a Configuration."

    Deleting a Caching Rule

    To delete a caching rule, click the Delete button. At the confirmation prompt, click OK.

Configuring Caching Settings Using the CLI

  • To change the caching properties for a configuration, run the set-cache-prop command.

    For example, the following command changes the maximum cache heap space to 20 MB.

    tadm> set-cache-prop --config=soa max-heap-space=20971520
    OTD-70201 Command 'set-cache-prop' ran successfully.
    
  • To create a caching rule for a virtual server, run the create-cache-rule command.

    For example, the following command creates a rule named cache-rule-images for the virtual server soa.example.com in the configuration soa, to cache the requests for which the expression $uri='^/images' evaluates to true.

    tadm> create-cache-rule --condition="\$uri='^/images'" --config=soa --vs=soa.example.com cache-rule-images
    OTD-70201 Command 'create-cache-rule' ran successfully.
    

    Note that the value of the --condition option should be a regular expression. For information about building condition expressions, see "Using Variables, Expressions, and String Interpolation" in the Oracle Traffic Director Configuration Files Reference.

  • To change a caching rule, run the set-cache-rule-prop command.

    For example, the following command disables compression of content for the caching rule cache-rule-images.

    tadm> set-cache-rule-prop --config=soa --vs=soa.example.com --rule=cache-rule-images compression=false
    OTD-70201 Command 'set-cache-rule-prop' ran successfully.
    
  • To delete a caching rule, run the delete-cache-rule command, as shown in the following example.

    tadm> delete-cache-rule --config=soa --vs=soa.example.com cache-rule-images
    OTD-70201 Command 'delete-cache-rule' ran successfully.
    

For the updated configuration to take effect, you should deploy it to the Oracle Traffic Director instances by using the deploy-config command.

For more information about the CLI commands mentioned in this section, see the Oracle Traffic Director Command-Line Reference or run the commands with the --help option.