Applies To:

Show Versions Show Versions

Manual Chapter: Invalidating Cached Content
Manual Chapter
Table of Contents   |   << Previous Chapter   |   Next Chapter >>

Overview: Invalidating cached content for an application

You typically use invalidations rules to expire specific content stored in cache. When you invalidate content, that content is immediately expired but not removed from the disk.

Invalidating cached content for an application

You can invalidate cached content for one or more applications, which expires, but does not clear, the cached content for the specified applications.
Note: Invalidating the cached content on the BIG-IP device temporarily increases traffic to the origin web servers until the BIG-IP device repopulates the cache.
  1. On the Main tab, click Acceleration > Web Application > Invalidate Content. The Invalidate Content screen opens.
  2. Select the check box for the application with cached content that you want to invalidate.
  3. Click Invalidate.
The cached content for the specified applications is invalidated.

Clearing cached content from the command line

There might be occasions, such as when troubleshooting cache issues, when you want to clear cache and remove content that the BIG-IP device has stored.
Note: Clearing cached content temporarily increases traffic to the origin web servers until the BIG-IP device repopulates the cache.
  1. Log on to tmsh.
  2. Type tmsh delete ltm profile wa-cache wa_profile_name at the command line, where wa_profile_name is the name of the Web Acceleration profile.
The content cached by the BIG-IP device is cleared.

Overview: Invalidating cached content for a node

Cache invalidation is a powerful tool that you can use to maintain tight coherence between the content on your origin web servers and the content that the BIG-IP system caches.

If you update content for your site at regular intervals, such as every day or every hour, you can use lifetime rules to ensure that the system’s cache is refreshed with the same frequency. Invalidations rules, however, allow you to expire cached content before it has reached its time to live (TTL) value, and is a good tool to use when content updates are event-driven, such as when an item is added to a shopping cart, a request contains a new auction bid, or a poster has submitted content on a forum thread.

When you configure invalidations rules, you define elements in a request that prompt the BIG-IP system to invalidate and refresh specific cached content. When the BIG-IP system receives a request that matches the parameters that you specified for the invalidations rule, it performs the following steps.

  • Invalidates the cached content that it would have served.
  • Sends the request to the origin web server for fresh content.
  • Replaces the specified content, which it previously had in cache, with the new content it receives from the origin web server.
  • Responds to the request with the refreshed content.

You can create invalidations rules that are based on a specific parameter, for example, an invalidation rule based on a certain cookie.

Important: Although there might be situations that require you to invalidate a significant portion of the cache, it is important to keep in mind that such a broad invalidation process can tax the origin web server as it attempts to respond to multiple requests for new content. For this reason, F5 Networks recommends that you make the invalidations rule parameters as specific as possible, whenever possible.

Creating an Invalidations rule

You can define a trigger in a policy that invalidates the obsolete cached post, and retrieves the updated post from the origin web server.
  1. On the Main tab, click Acceleration > Web Application > Policies. The Policies screen displays a list of existing acceleration policies.
  2. Click the name of a user-defined acceleration policy.
  3. Click a leaf node in the Policy Tree.
  4. From the Matching Rules menu, choose Acceleration Rules.
  5. Click Invalidations.
  6. Click Create.
  7. In the Description field, type a description.
  8. Define the parameters that the BIG-IP system must match in a request. These parameters trigger the invalidations rule.
    Important: All parameters are optional except for the Path parameter. If you do not specify the Path parameter for the Request Header Matching Criteria and the Cached Content to Invalidate settings, the invalidations rule does not trigger the BIG-IP system to invalidate the specified cache. If you do not want to define a specific path, you can use a single slash (/).
    1. In the Add Parameter list, select Path.
    2. Click Add.
    3. In the Value(s) field, type the path for an application. For example, to invalidate cached content for the application /apps/doSomething.jsp, type /apps/doSomething.jsp. The BIG-IP system triggers the invalidations rule only for this application. All other requests that match to the Default node do not trigger this invalidations rule.
    4. Click Save. The path appears in the Request Header Matching Criteria table.
  9. Define the content to invalidate and refresh. This content is invalidated and refreshed when the Request Header Matching Criteria setting specifies the parameters in the HTTP request header.
    1. In the Add Parameter list, select Path.
    2. Click Add.
    3. In the Type list, select Value Group.
    4. In the Value Group field, type the path for the content. For example, to invalidate cached content for /srch/doSimpleSearch.jsp, type /srch/doSimpleSearch.jsp.
    5. Click Save. The path appears in the Request Header Matching Criteria table.
The trigger in the policy invalidates the obsolete cached post, and retrieves the updated post from the origin web server.

Blog invalidations rule example

In this example, a participant posts an update to a blog, which you want to make available through an invalidation rule, instead of sending the cached version without the updated post. You can define a trigger in a policy that invalidates the obsolete cached post, and retrieves the updated post from the origin web server.

First, you can create a View leaf node that includes Matching rules with these settings:

Parameter Name Value
Path Path STARTS WITH /
Query Parameter view MATCHES topic
Content Type Content Type MATCHES pages.html OR IS UNCLASSIFIED

Then, you can create a Post leaf node that includes Matching rules with these settings:

Parameter Name Value
Path Path STARTS WITH /
Query Parameter view MATCHES post
Query Parameter forumid MATCHES *
Content Type Content Type MATCHES pages.html OR IS UNCLASSIFIED

Finally, you can specify the Invalidations rules for the Post leaf node to include these settings:

Request Header Matching Criteria

Parameter Name Value
Path Path STARTS WITH /
Query Parameter view MATCHES post
Query Parameter forumid MATCHES *
Query Parameter postid MATCHES *

Cached Content to Invalidate

Parameter Name Value
Path Path STARTS WITH /
Query Parameter view MATCHES topic
Query Parameter forumid Source forumid [Query Parameter]
Query Parameter postid Source postid [Query Parameter]

Creating leaf nodes for the blog example invalidations rule

In this task, you create View and Post leaf nodes in the Policy Tree for the example blog invalidations rule.
  1. On the Main tab, click Acceleration > Web Application > Policies. The Policies screen displays a list of existing acceleration policies.
  2. Click the name of a user-defined acceleration policy.
  3. Click the Blog branch node in the Policy Tree.
  4. From the Matching Rules menu, choose Acceleration Rules.
  5. Click Invalidations.
  6. Create a leaf node named View.
    1. Click Add on the Policy Tree function bar.
    2. Name the node View.
    3. Type a description.
    4. Click Create.
  7. Create a leaf node named Post.
    1. Click Add on the Policy Tree function bar.
    2. Name the node Post.
    3. Type a description.
    4. Click Create.
The View and Post nodes appear in the Policy Tree.

Specifying matching rules for the invalidations example View node

A View and Post leaf node have been created.
This task configures matching rules for the invalidations example View node.
  1. Click the View node.
  2. For Matching Rules, specify the Path settings.
    1. In the Add Parameter list, select Path.
    2. Click Add.
    3. In the Value field, type /.
    4. Click Save.
  3. For Matching Rules, specify the view settings.
    1. In the Add Parameter list, select Query Parameter.
    2. Click Add.
    3. In the Name field, type view.
    4. Select the check box beside the Value matches list.
    5. In the Enter a regular expression field, type topic.
    6. Click Save.
  4. For Matching Rules, specify the Content Type settings.
    1. In the Add Parameter list, select Content Type.
    2. Click Add.
    3. Select the check box beside the Value matches list.
    4. In the Enter a regular expression field, type pages.html.
    5. Select the Match if not yet classified check box.
    6. Click Save.
The matching rules for the invalidations example View node are configured.

Specifying matching rules for the invalidations example Post node

A View and Post leaf node have been created.
This task configures matching rules for the invalidations example Post node.
  1. Click the Post node.
  2. For Matching Rules, specify the Path settings.
    1. In the Add Parameter list, select Path.
    2. Click Add.
    3. In the Value field, type /.
    4. Click Save.
  3. For Matching Rules, specify the forumid settings.
    1. In the Add Parameter list, select Query Parameter.
    2. Click Add.
    3. In the Name field, type forumid.
    4. Select the check box beside the Value matches list.
    5. In the Enter a regular expression field, type *.
    6. Click Save.
  4. For Matching Rules, specify the view settings.
    1. In the Add Parameter list, select Query Parameter.
    2. Click Add.
    3. In the Name field, type view.
    4. Select the check box beside the Value matches list.
    5. In the Enter a regular expression field, type post.
    6. Click Save.
  5. For Matching Rules, specify the Content Type settings.
    1. In the Matching Rules Add Parameter list, select Content Type.
    2. Click Add.
    3. Select the check box beside the Value matches list.
    4. In the Enter a regular expression field, type pages.html.
    5. Select the Match if not yet classified check box.
    6. Click Save.
The matching rules for the invalidations example Post node are configured.

Task summary for specifying invalidations rules for the invalidations example Post node

Perform these tasks to configure the invalidations blog example Post node.

Task summary

Configuring blog example Path settings for the Post node invalidations rules

A View and Post leaf node have been created.
In this task for configuring blog invalidations rules, you specify Path settings for the Post node invalidations rules.
  1. Click the Post node.
  2. In the Matching Rules list, select Acceleration Rules.
  3. Click Invalidations.
  4. Click Create.
  5. In the Description field, type a description.
  6. For Request Header Matching Criteria, specify the Path settings.
    1. In the Add Parameter list, select Path.
    2. Click Add.
    3. In the Value(s) field, type /.
    4. Click Save.
  7. For Cached Content to Invalidate, specify the Path settings.
    1. In the Add Parameter list, select Path.
    2. Click Add.
    3. In the Value Group field, type /.
    4. Click Save.
The Path settings for the Post node are configured for the example blog invalidations rules.

Configuring blog example view settings for the Post node invalidations rules

A View and Post leaf node have been created.
In this task for configuring blog invalidations rules, you specify view settings for the Post node invalidations rules.
  1. Click the Post node.
  2. In the Matching Rules list, select Acceleration Rules.
  3. Click Invalidations.
  4. Click Create.
  5. In the Description field, type a description.
  6. For Request Header Matching Criteria, specify the view settings.
    1. In the Add Parameter list, select Query Parameter.
    2. Click Add.
    3. In the Name field, type view.
    4. Select the check box beside the Value matches list.
    5. In the Enter a regular expression field, type post.
    6. Click Save.
  7. For Cached Content to Invalidate, specify the view settings.
    1. In the Add Parameter list, select Query Parameter.
    2. Click Add.
    3. In the Name field, type view.
    4. Select the check box beside the Value matches list.
    5. In the Enter a regular expression field, type topic.
    6. Click Save.
The view settings for the Post node are configured for the example blog invalidations rules.

Configuring blog example forumid settings for the Post node invalidations rules

A View and Post leaf node have been created.
In this task for configuring blog invalidations rules, you specify forumid settings for the Post node invalidations rules.
  1. Click the Post node.
  2. In the Matching Rules list, select Acceleration Rules.
  3. Click Invalidations.
  4. Click Create.
  5. In the Description field, type a description.
  6. For Request Header Matching Criteria, specify the forumid settings.
    1. In the Add Parameter list, select Query Parameter.
    2. Click Add.
    3. In the Name field, type forumid.
    4. Select the check box beside the Value matches list.
    5. In the Enter a regular expression field, type *.
    6. Click Save.
  7. For Cached Content to Invalidate, specify the forumid settings.
    1. In the Add Parameter list, select Query Parameter.
    2. Click Add.
    3. In the Name field, type forumid.
    4. In the Type list, select Query Parameter from Request.
    5. In the Name field, type forumid.
    6. Click Save.
The forumid settings for the Post node invalidations rules are configured for the example blog invalidations rules.

Configuring blog example postid settings for the Post node invalidations rules

A View and Post leaf node have been created.
In this task for configuring blog invalidations rules, you specify postid settings for the Post node invalidations rules.
  1. Click the Post node.
  2. In the Matching Rules list, select Acceleration Rules.
  3. Click Invalidations.
  4. Click Create.
  5. In the Description field, type a description.
  6. For Request Header Matching Criteria, specify the postid settings.
    1. In the Add Parameter list, select Query Parameter.
    2. Click Add.
    3. In the Name field, type postid.
    4. Select the check box beside the Value matches list.
    5. In the Enter a regular expression field, type *.
    6. Click Save.
  7. For Cached Content to Invalidate, specify the postid settings.
    1. In the Add Parameter list, select Query Parameter.
    2. Click Add.
    3. In the Name field, type postid.
    4. In the Type list, select Query Parameter from Request.
    5. In the Name field, type postid.
    6. Click Save.
The postid settings for the Post node invalidations rules are configured for the example blog invalidations rules.
Table of Contents   |   << Previous Chapter   |   Next Chapter >>

Was this resource helpful in solving your issue?




NOTE: Please do not provide personal information.



Incorrect answer. Please try again: Please enter the words to the right: Please enter the numbers you hear:

Additional Comments (optional)