With release 18.1.2, Avi Vantage can base the caching of responses based on URIs as well as MIME types.
Previously the sole option, MIME-type-based caching is based on cache-control configuration parameters such as cacheable or non-cacheable MIME types within the application profile. This config determines whether a successful response from the server will be cached by Avi Vantage or not. If cacheable MIME types is configured (it is not the default), a 200 OK response from the server is cached only if its MIME type matches one of the references within the cacheable MIME types list. Otherwise the response will be not be cached. If only a non-cacheable list of MIME types is configured, a 200 OK response with matching MIME type will not be cached and everything else will be cached. If the user configures both cacheable and non-cacheable lists of MIME types, then only responses matching the entries in the cacheable list are cached; any non-cacheable list is essentially disregarded.
Selective URI Caching
In contrast to MIME-type-based caching, selective URI caching (new for 18.1.2) is finer grained; it is based on a non-cacheable URI list. This list has match criteria and an option to configure a set of string groups, each of which stores one or more URIs as strings. If a non-cacheable list of URIs is configured, a 200 OK response for a request URI that matches this list will not be cached. Following the outcome of processing the URI against this list, the cache/fetch decision also depends on request and response cache control headers, such as no-cache/no-store and other caching-related configuration specific in the application profile.
Figure 1 below shows processing of a request URI against cacheable and non-cacheable MIME type and non-cacheable URI cache configuration.
Non-Cacheable URI PathMatch Configuration
In addition to enabling caching, the configuration accepts
- a match criterion,
- an option to determine case sensitivity, and
- a list of URIs.
| cache_config | | enabled | True | . . . | uri_non_cacheable | | match_criteria | DOES_NOT_EQUAL | | match_case | INSENSITIVE | | string_group_refs | non-uri_sg
Full Set of
uri_non_cacheable Configuration Parameters
match_criteriaparameter can take on the following values:
match_caseparameter can be either SENSITIVE or INSENSITIVE, with INSENSITIVE being default.
string_group_refsparameter is a list of string-group references with URIs configured as strings in them. These can be configured by navigating in the Avi UI to Templates > Groups > String Groups.
uri_non_cacheablecache path match has no
string_group_refsdefined, then Avi Vantage does not do URI-based selective caching for the request.
uri_non_cacheablepath match object can also have a string option (besides string groups). However, adding URIs as strings in a path match is not supported.
Ignore Request Cache Control
In an application profile’s cache configuration, if
ignore_request_cache_control is set to
True, then client cache-control headers (shown below) will be ignored and Avi Vantage will fetch/store from/to the cache following the cache-control flow previously depicted. If this flag is set to
False, client cache-control flags in the request will be honored. By default, this flag is set to
False. The following cache expiration directive will be ignored when
ignore_request_cache_control is set to
Cache Expiration Directive on Request
- Pragma: no-cache - Cache-control: no-cache | no-store max-age == 0
To match query params also along with the URI, the user must turn on the
query_cacheable option in the caching configuration to
True. This allows the caching logic to include query parameters also along with URI when matching against URI strings in string groups configred in
Sample CLI Configuration
Applicationprofile: http_profile: cache_config : enabled True xcache_header True age_header True date_header True min_object_size 10 max_object_size 4194304 default_expire 600 heuristic_expire False max_cache_size 0 query_cacheable True aggressive True uri_non_cacheable match_criteria EQUALS match_case INSENSITIVE string_group_refs uri_strings ignore_request_cache_control True
Avi UI Configuration
Navigate to Templates > Profiles. Create a new application profile or edit some pre-existing one. Select the Caching tab. Note that caching is off by default, as shown in Figure 2.
Click the checkbox to reveal more caching options. Once caching has been clicked ON, the selective caching checkbox (unchecked by default) likewise needs to be clicked to reveal and/or set options: