Triggers and functions
The latest addition to Redis Stack is the capacity to respond to specific events happening in your Redis database and define business logic that executes the desired actions. These events can be triggered by changes to the data, such as adding a new key-value pair. When an event occurs, the specified JavaScript function is automatically executed. However, this is not the only way to execute the desired functions: Redis Stack supports two types of triggers for execution while supporting manual user execution. For a summary, see the following:
- User functions: Functions can be executed manually, using the TFCALL or TFCALLASYNC command
- Keyspace triggers: These triggers are activated when there are changes to the data stored in Redis, and they execute the desired function
- Stream triggers: Whenever new items are added to a Stream, these triggers are activated and execute the desired function
The advantage of using triggers is that you can keep...