RAM cache commands
Before you begin, ensure RAM caching configuration is selected in the HTTP or HTTPs profile. |
HTTP:exclude_check_disable() — Disables the exclude URI check.
HTTP:cache_disable() — Disables caching (both cache hit and cache store).
HTTP:dyn_check_disable() — Disables dynamic caching check.
HTTP:dyn_invalid_check_disable() — Disables dynamic invalid caching check.
HTTP:dyn_cache_enable(t) — Directly enables dynamic caching with a given ID and age.
HTTP: cache_user_key(t) — Replaces the default key (the URI) with any customized key.
HTTP:dyn_cache_invalid(t) — Invalidates a given dynamic cache indexed by its ID.
HTTP:cache_check(t) — Checks whether a URI has been cached or not.
HTTP:cache_hits(t) — Checks the cache hit count for the specified URI.
HTTP:res_caching() — Checks whether or not the response has been caching. If yes, then it checks whether it is regular cache or dynamic cache.
HTTP:res_cached() — Check whether or not a response is from cache. If yes, then it checks whether it is regular cache or dynamic cache.
HTTP:caching_drop() — Drops an ongoing caching operation.
HTTP:exclude_check_disable()
Disables the exclude URI check.
Syntax
HTTP:exclude_check_disable();
Arguments
N/A
Example
when HTTP_REQUEST { if HTTP:exclude_check_disable() then debug("set HTTP:exclude_check_disable: true\n"); else debug("set HTTP:exclude_check_disable: Fail"); end }
FortiADC version: V5.3
Used in events: HTTP_REQUEST
HTTP:cache_disable()
Disables caching (both cache hit and cache store).
Syntax
HTTP: cache_disable();
Arguments
N/A
Example
when HTTP_REQUEST { HTTP:cache_disable() }
FortiADC version: V5.3
Used in events: HTTP_REQUEST
HTTP:dyn_check_disable()
Disables dynamic caching check.
Syntax
HTTP: dyn_check_disable();
Arguments
N/A
Example
when HTTP_REQUEST { HTTP:dyn_check_disable }
FortiADC version: V5.3
Used in events: HTTP_REQUEST
HTTP:dyn_invalid_check_disable()
Disables dynamic invalid caching check.
Syntax
HTTP:dyn_invalid_check_disable();
Arguments
N/A
Example
when HTTP_REQUEST { HTTP:dyn_invalid_check_disable() }
FortiADC version: V5.3
Used in events: HTTP_REQUEST
HTTP:dyn_cache_enable(t)
Directly enables dynamic caching with a given ID and age.
Syntax
HTTP:dyn_cache_enable(t);
Arguments
Name | Description |
---|---|
t |
A table which specifies the ID and age of caching. |
Examples
when HTTP_REQUEST { t={} t["id"] = 1; t["age"] = 20; --in seconds ret=HTTP:dyn_cache_enable(t) }
FortiADC version: V5.3
Used in events: HTTP_REQUEST
HTTP: cache_user_key(t)
Replaces the default key (the URI) with any customized key.
Syntax
HTTP:cache_user_key(t);
Arguments
Name | Description |
---|---|
t |
A table which specifies the caching URI. |
Example
when HTTP_REQUEST { url = HTTP:uri_get() new_url = url.."external"; t={}; t["uri"] = new_url HTTP:cache_user_key(t) }
FortiADC version: V5.3
Used in events: HTTP_REQUEST
HTTP:dyn_cache_invalid(t)
Invalidates a given dynamic cache indexed by its ID.
Syntax
HTTP:dyn_cache_invalid(t);
Arguments
Name | Description |
---|---|
t |
A table which specifies the cache ID. |
Example
when HTTP_REQUEST { t={} t["id"] = 1 --between 1 and 1023 ret = HTTP:dyn_cache_invalid(t); }
FortiADC version: V5.3
Used in events: HTTP_REQUEST / HTTP_RESPONSE
HTTP:cache_check(t)
Checks whether a URI has been cached or not.
Syntax
HTTP:cache_check(t);
Arguments
Name | Description |
---|---|
t |
A table which specifies the cached URI. |
Example
when HTTP_REQUEST { t={} t["uri"] = "/3.htm"; ret=HTTP:cached_check(t) if ret then debug("cached with id %s\n", ret); else debug("not cached\n"); end }
FortiADC version: V5.3
Used in events: HTTP_REQUEST / HTTP_RESPONSE
HTTP:cache_hits(t)
Checks the cache hit count for the specified URI.
Syntax
HTTP:cache_hits(t);
Arguments
Name | Description |
---|---|
t |
A table which specifies the cached URI. |
Example
when HTTP_REQUEST { t={} t["uri"] = "/3.htm"; ret=HTTP:cache_hits(t) if ret then debug("cache hit count %s\n", ret); else debug("not cached\n"); end }
FortiADC version: V5.3
Used in events: HTTP_REQUEST / HTTP_RESPONSE
HTTP:res_caching()
Checks whether or not the response has been caching. If yes, then it checks whether it is regular cache or dynamic cache.
Syntax
HTTP:res_caching();
Arguments
N/A
Example
when HTTP_RESPONSE { id = HTTP:res_caching(); if id then debug("HTTP:res_caching() response caching with id %s !!!!\n", id); else debug("HTTP:res_caching() response NOT caching\n"); end }
FortiADC version: V5.3
Used in events: HTTP_RESPONSE
HTTP:res_cached()
Check whether or not a response is from cache. If yes, then it checks whether it is regular cache or dynamic cache.
Syntax
HTTP:res_cached();
Arguments
N/A
Example
when HTTP_RESPONSE { ret = HTTP:res_cached(); if ret then debug("HTTP:res_cached() response from cache !!!!\n"); else debug("HTTP:res_cached() response NOT from cache\n"); end }
FortiADC version: V5.3
Used in events: HTTP_RESPONSE
HTTP:caching_drop()
Drops an ongoing caching operation.
Syntax
HTTP:caching_drop();
Arguments
N/A
Example
when HTTP_RESPONSE { ret=HTTP:caching_drop() if ret then debug("script dropping caching: True\n") else debug("script dropping caching: False\n"); end }
FortiADC version: V5.3
Used in events: HTTP_RESPONSE