Fortinet Document Library

Version:

Version:

Version:

Version:

Version:

Version:

Version:


Table of Contents

CLI Reference

config load-balance caching

Use this command to configure the system cache.

The system RAM cache can store HTTP content and serve subsequent HTTP requests for that content without forwarding the requests to the backend servers, thereby reducing the load on the backend servers.

You can configure basic static caching or dynamic caching rules. For an overview of static and dynamic caching, see the FortiADC Handbook.

Before you begin:

  • You must have a good understanding of caching and knowledge about the size of content objects clients access on the backend servers.
  • You must have read-write permission for load balancing settings.

Caching is not enabled by default. After you have configured caching, you can select it in the profile configuration. To enable caching, select the profile when you configure the virtual server.

Syntax

config load-balance caching

edit <name>

set max-age <integer>

set max-cache-size <integer>

set max-entries <integer>

set max-object-size <integer>

config uri_exclude_list

edit <No.>

set uri <string>

next

end

config dyn-cache-list

edit <No.>

set uri <string>

set age <integer>

set invalid-uri <string>

next

end

next

end

max-age

The default is 43,200 seconds. The valid range is 60 to 86,400.

The backend real server response header also includes a maximum age value. The FortiADC system enforces whichever value is smaller.

max-cache-size

The default is 100 MB. The valid range is 1 byte to 500 MB.

max-entries

The default is 10,000. The valid range is 1 to 262,144.

max-object-size

The default is 1 MB. The valid range is 1 byte to 10 MB.

config uri_exclude_list

uri

Specify URIs to build a list or sites to exclude from caching. You can use regular expressions.

This list has precedence over the Dynamic Cache Rule List. In other words, if a URI matches this list, it is ineligible for caching, even if it also matches the Dynamic Cache Rule list.

config dyn-uri-list

uri

Pattern to match the URIs that have content you want cached and served by FortiADC.

Be careful with matching patterns and the order rules in the list. Rules are consulted from lowest rule ID to highest. The first rule that matches is applied.

age

Timeout for the dynamic cache entry. The default is 60 seconds. The valid range is 1-86,400. This age applies instead of any age value in the backend server response header.

invalid-uri

Pattern to match URIs that trigger cache invalidation.

Be careful with matching patterns and the order rules in the list. Rules are consulted from lowest rule ID to highest. The first rule that matches is applied.

This list has precence over the Dynamic Cache URI list. In other words, if a URI matches this list, it is ineligible for caching, even if it also matches the Dynamic Cache URI list.

Example

FortiADC-VM # config load-balance caching

 

FortiADC-VM (caching) # edit lb-caching

Add new entry 'lb-caching' for node 2054

FortiADC-VM (lb-caching) # get

max-object-size : 1M

max-cache-size : 100M

max-entries : 10000

max-age : 43200

 

FortiADC-VM (lb-caching) # set max-cache-size 50M

FortiADC-VM (lb-caching) # end

config load-balance caching

Use this command to configure the system cache.

The system RAM cache can store HTTP content and serve subsequent HTTP requests for that content without forwarding the requests to the backend servers, thereby reducing the load on the backend servers.

You can configure basic static caching or dynamic caching rules. For an overview of static and dynamic caching, see the FortiADC Handbook.

Before you begin:

  • You must have a good understanding of caching and knowledge about the size of content objects clients access on the backend servers.
  • You must have read-write permission for load balancing settings.

Caching is not enabled by default. After you have configured caching, you can select it in the profile configuration. To enable caching, select the profile when you configure the virtual server.

Syntax

config load-balance caching

edit <name>

set max-age <integer>

set max-cache-size <integer>

set max-entries <integer>

set max-object-size <integer>

config uri_exclude_list

edit <No.>

set uri <string>

next

end

config dyn-cache-list

edit <No.>

set uri <string>

set age <integer>

set invalid-uri <string>

next

end

next

end

max-age

The default is 43,200 seconds. The valid range is 60 to 86,400.

The backend real server response header also includes a maximum age value. The FortiADC system enforces whichever value is smaller.

max-cache-size

The default is 100 MB. The valid range is 1 byte to 500 MB.

max-entries

The default is 10,000. The valid range is 1 to 262,144.

max-object-size

The default is 1 MB. The valid range is 1 byte to 10 MB.

config uri_exclude_list

uri

Specify URIs to build a list or sites to exclude from caching. You can use regular expressions.

This list has precedence over the Dynamic Cache Rule List. In other words, if a URI matches this list, it is ineligible for caching, even if it also matches the Dynamic Cache Rule list.

config dyn-uri-list

uri

Pattern to match the URIs that have content you want cached and served by FortiADC.

Be careful with matching patterns and the order rules in the list. Rules are consulted from lowest rule ID to highest. The first rule that matches is applied.

age

Timeout for the dynamic cache entry. The default is 60 seconds. The valid range is 1-86,400. This age applies instead of any age value in the backend server response header.

invalid-uri

Pattern to match URIs that trigger cache invalidation.

Be careful with matching patterns and the order rules in the list. Rules are consulted from lowest rule ID to highest. The first rule that matches is applied.

This list has precence over the Dynamic Cache URI list. In other words, if a URI matches this list, it is ineligible for caching, even if it also matches the Dynamic Cache URI list.

Example

FortiADC-VM # config load-balance caching

 

FortiADC-VM (caching) # edit lb-caching

Add new entry 'lb-caching' for node 2054

FortiADC-VM (lb-caching) # get

max-object-size : 1M

max-cache-size : 100M

max-entries : 10000

max-age : 43200

 

FortiADC-VM (lb-caching) # set max-cache-size 50M

FortiADC-VM (lb-caching) # end