avi.vs.table_insert

DataScript

Function avi.vs.table_insert( [table_name,] key, value [, lifetime] )
Description The table API is used to store and retrieve custom data.
The avi.vs.table_insert API stores the value in a key-value store for the key.
This key-value store is unique for every virtual service and is mirrored across all service engines hosting the virtual service.
Events VS_DATASCRIPT_EVT_L4_REQUEST
VS_DATASCRIPT_EVT_L4_RESPONSE
Parameters If the optional table_name is not specified, the key-value pair is stored in a default table for the virtual service. When it is specified, a new table with the custom name will be used. A virtual service with multiple tables can have the same key name with different values for each table.
The key is used to look up the value.
The value is the custom data to be stored. The optional lifetime flag must be a positive integer, indicating the length of time in seconds this record should exist. When the time runs out, the key and value are silently discarded. If the lifetime flag is not specified, the default value of 300 seconds is used.
Minimum lifetime supported is 300s.
Returns Returns the boolean value true if the insertion is a success and false if the insertion is a failure.
Example

if radius_username == “myuser” then
   avi.vs.table_insert(radius_username, “10.2.3.4:1812”, 3600)
end

Inserting a key that already exists will reset the lifetime of the key. The value associated with the key will remain same and not be overwritten.