![]() ![]() Please refer to the Redis Lua API Reference page for complete documentation.Īlthough the server executes them, Eval scripts are regarded as a part of the client-side application, which is why they're not named, versioned, or persisted. Presently, Redis supports a single scripting engine, the Lua 5.1 interpreter. Scripts are executed in Redis by an embedded execution engine. Such scripts can perform conditional updates across multiple keys, possibly combining several different data types atomically. Lua lets you run part of your application logic inside Redis. Enabling the composition of simple capabilities that are either missing from Redis or are too niche to a part of it.Blocking semantics that ensure the script's atomic execution.Data locality reduces overall latency and saves networking resources. Providing locality by executing logic where data lives. ![]() Scripting offers several properties that can be valuable in many cases. These semantics mean that all of the script's effects either have yet to happen or had already happened. While executing the script, all server activities are blocked during its entire runtime. ![]() Redis guarantees the script's atomic execution. Scripts can employ programmatic control structures and use most of the commands while executing to access the database.īecause scripts execute in the server, reading and writing data from scripts is very efficient. Records are not created in the log if the level of the record is lower than the log level set for the process in the Settings of Server and sensors window.Redis lets users upload and execute Lua scripts on the server. Variables or constants defined by function arguments are separated by a tab character in a log record. print(function_argument1, function_argument2,…) creates a log record with the Debug level that may contain multiple arguments of the function._WriteDebugLog(function_argument) creates a log record with the Debug level._WriteInfoLog(function_argument) creates a log record with the Informational level._WriteWarningLog(function_argument) creates a log record with the Warning level._WriteErrorLog(function_argument) creates a log record with the Error level._WriteCriticalLog(function_argument) creates a log record with the Critical level.A record defined by an argument of the function (variable or constant) is added to the log: You can use functions for adding a record to the process log in which the Lua script is executed (this is normally a process whose name starts with the word Filter). The added variable may be used in the format $extra. You can use the added variable in the settings of custom event types. _AddEventParam('parameter_name', parameter_value) The following function is used to add a variable: When creating a rule using a Lua script, you can use additional variables with a user-defined name and value. If a modifier is not specified, any most recent tag value is used. You are not required to specify a modifier. W – tag is intercepted when writing the tag to the device. R – tag is intercepted when reading the tag from the device. Where the following modifier values are used. Tags are described in the function code by an expression in the following format: The application Server will begin to register events based on the changes made to the rule. Select or configure the type of registered event.Enter the code of the script in the Lua language.Ĭlick the help button above the script entry field to open the window containing detailed comments for creating a script.In the Lua script editor above the script entry field, select the Rule script option.The Lua script editor appears in the lower part of the tab. In the list of Process Control rules, select the rule with the Lua script that you want to edit.Editing a Lua script in a Process Control rule.The defined global variables and functions of a global Lua script can be used when creating or editing rules containing Lua scripts. To apply the changes, apply the security policy.To open the window containing comments on creating a global script, click the help button above the script entry field. In the script entry field, enter the code of the script in the Lua language.In the Lua script editor above the script entry field, select the Global script option.Select any rule containing the Lua script.If the list of Process Control rules contains at least one rule that has a Lua script:.You can select the group itself or one of the existing rules from the group. If the list of Process Control rules contains groups, select the group in which the rule containing a Lua script will be created.If the list of Process Control rules does not contain rules containing Lua scripts, create a new rule with a Lua script.To do so, you can use one of the following methods: ![]()
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |