Applies To:
Show VersionsBIG-IP AAM
- 12.1.5, 12.1.4, 12.1.3, 12.1.2, 12.1.1, 12.1.0, 11.6.5, 11.6.4, 11.6.3, 11.6.2, 11.6.1
Invalidating Cached Content
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
Clearing cached content from the command line
- Log on to tmsh.
- 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.
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.
Creating an Invalidations rule
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
Specifying matching rules for the invalidations example View node
- Click the View node.
-
For Matching Rules, specify the
Path settings.
- In the Add Parameter list, select Path.
- Click Add.
- In the Value field, type /.
- Click Save.
-
For Matching Rules, specify the
view settings.
- In the Add Parameter list, select Query Parameter.
- Click Add.
- In the Name field, type view.
- Select the check box beside the Value matches list.
- In the Enter a regular expression field, type topic.
- Click Save.
-
For Matching Rules, specify the Content
Type settings.
- In the Add Parameter list, select Content Type.
- Click Add.
- Select the check box beside the Value matches list.
- In the Enter a regular expression field, type pages.html.
- Select the Match if not yet classified check box.
- Click Save.
Specifying matching rules for the invalidations example Post node
- Click the Post node.
-
For Matching Rules, specify the
Path settings.
- In the Add Parameter list, select Path.
- Click Add.
- In the Value field, type /.
- Click Save.
-
For Matching Rules, specify the
forumid settings.
- In the Add Parameter list, select Query Parameter.
- Click Add.
- In the Name field, type forumid.
- Select the check box beside the Value matches list.
- In the Enter a regular expression field, type *.
- Click Save.
-
For Matching Rules, specify the
view settings.
- In the Add Parameter list, select Query Parameter.
- Click Add.
- In the Name field, type view.
- Select the check box beside the Value matches list.
- In the Enter a regular expression field, type post.
- Click Save.
-
For Matching Rules, specify the Content
Type settings.
- In the Matching Rules Add Parameter list, select Content Type.
- Click Add.
- Select the check box beside the Value matches list.
- In the Enter a regular expression field, type pages.html.
- Select the Match if not yet classified check box.
- Click Save.
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
- Click the Post node.
- In the Matching Rules list, select Acceleration Rules.
- Click Invalidations.
- Click Create.
- In the Description field, type a description.
-
For Request Header Matching Criteria, specify the
Path settings.
- In the Add Parameter list, select Path.
- Click Add.
- In the Value(s) field, type /.
- Click Save.
-
For Cached Content to Invalidate, specify the
Path settings.
- In the Add Parameter list, select Path.
- Click Add.
- In the Value Group field, type /.
- Click Save.
Configuring blog example view settings for the Post node invalidations rules
- Click the Post node.
- In the Matching Rules list, select Acceleration Rules.
- Click Invalidations.
- Click Create.
- In the Description field, type a description.
-
For Request Header Matching Criteria, specify the
view settings.
- In the Add Parameter list, select Query Parameter.
- Click Add.
- In the Name field, type view.
- Select the check box beside the Value matches list.
- In the Enter a regular expression field, type post.
- Click Save.
-
For Cached Content to Invalidate, specify the
view settings.
- In the Add Parameter list, select Query Parameter.
- Click Add.
- In the Name field, type view.
- Select the check box beside the Value matches list.
- In the Enter a regular expression field, type topic.
- Click Save.
Configuring blog example forumid settings for the Post node invalidations rules
- Click the Post node.
- In the Matching Rules list, select Acceleration Rules.
- Click Invalidations.
- Click Create.
- In the Description field, type a description.
-
For Request Header Matching Criteria, specify the
forumid settings.
- In the Add Parameter list, select Query Parameter.
- Click Add.
- In the Name field, type forumid.
- Select the check box beside the Value matches list.
- In the Enter a regular expression field, type *.
- Click Save.
-
For Cached Content to Invalidate, specify the
forumid settings.
- In the Add Parameter list, select Query Parameter.
- Click Add.
- In the Name field, type forumid.
- In the Type list, select Query Parameter from Request.
- In the Name field, type forumid.
- Click Save.
Configuring blog example postid settings for the Post node invalidations rules
- Click the Post node.
- In the Matching Rules list, select Acceleration Rules.
- Click Invalidations.
- Click Create.
- In the Description field, type a description.
-
For Request Header Matching Criteria, specify the
postid settings.
- In the Add Parameter list, select Query Parameter.
- Click Add.
- In the Name field, type postid.
- Select the check box beside the Value matches list.
- In the Enter a regular expression field, type *.
- Click Save.
-
For Cached Content to Invalidate, specify the
postid settings.
- In the Add Parameter list, select Query Parameter.
- Click Add.
- In the Name field, type postid.
- In the Type list, select Query Parameter from Request.
- In the Name field, type postid.
- Click Save.