PROXY:shared_table_insert(table_name, key, value)
Inserts a pair of <key, value> as an entry into the shared table. If the key already exists in the table or if the table is full, the function will do nothing. The key can be a Lua string or integer while the value can be a Lua string, integer, or table.
This function will fail if the table has not been created yet; it will not trigger the creation of a new table.
Returns Boolean true if successful, otherwise, returns Boolean false.
Syntax
PROXY:shared_table_insert(table_name, key, value);
Arguments
| Name | Description |
|---|---|
| table_name |
A Lua string as the name of the shared table. This is the unique identification of a shared table. This parameter is mandatory. The maximum length of this table name is 255. |
|
key |
The key can be a Lua string or integer. This parameter is mandatory. The maximum length for the string is 255. |
|
value |
The value can be a Lua string, integer, or table. The table will be serialized before storing into the shared table. This parameter is mandatory. The maximum length of any value is 64K. |
Events
All events except: PERSISTENCE, POST_PERSIST, CLIENTSSL_HANDSHAKE.
Example
when HTTP_REQUEST {
table_name = "TableDemo1"
key1="keyString101"
val1="valString101"
ret = PROXY:shared_table_insert(table_name, key1, val1)
if ret then
debug("===>>shared_table_insert success:[Table:%s] [%s]=[%s]\n",table_name, key1, val1)
else
debug("===>>shared_table_insert failed:[Table:%s] [%s]=[%s]\n",table_name, key1, val1)
end
}
Supported Version
FortiADC version 7.4.2 and later.