Triggers & functions

Enhanced Redis programmability

Triggers and Functions Enhanced Redis programmability

Triggers and functions give Redis powerful features for event-driven data processing. Using JavaScript, devs can create dev-defined functions against data stored in Redis.

Devs can define server-side functions that events trigger for execution.

Use an event-driven model that creates new ways to process data within Redis using Redis Stack. Triggers and functions work with a JavaScript engine that handles complex data types directly on data stored in Redis Enterprise.

What is a trigger?

A trigger is an event associated with data processing within Redis. Triggers encompass on-demand calls to a function, a specific command execution, stream processes, or time-related events. Any of these conditions can trigger the execution of a function stored in Redis.

What is a function?

Functions are JavaScript dev-defined functions stored in the Redis database. These functions run when an event triggers the execution or on demand. Functions can run on all shards directly where data lives and they can read data across shards.

Benefits

Faster app logic

The app logic runs where the data lives and it executes when the data is changed. This removes network latency caused by data requests to and from the database used by third-party services.

Simpler app logic

Eliminates the need to maintain the same code across different apps. You can move app functionality inside the Redis database instead of transporting the code from the client app to the database every time you execute that code.

Better data consistency

Maintain consistent data when apps react to changing real-time conditions in the keyspace instead of using Pub/Sub notifications. The app performs the same functions when a defined trigger is encountered.

A JavaScript engine

You already know JavaScript, which means there’s no learning curve. You can get right to work to define functions.

Improved code resiliency

The database contains the code to execute these functions. The triggers and functions are backed up and replicated along with the database.

Use cases

Extend and validate data

Extend and validate data

Instead of sending metadata, process data, or validation requests to client applications for processing, add them directly on Redis.

Cross-application consistency

Cross-app consistency

Avoid duplicating code in each app. Each dev-defined function executes consistently in the Redis database regardless of the programming language used.

Transaction management

Transaction management

Construct complex database operations in a single transaction, ensuring data integrity and consistent processing directly in the Redis database.

Try it now

Redis Stack includes the preview of triggers and functions. You can deploy a public preview with Redis Stack in the cloud by creating a database on Redis Cloud in the fixed tier within the Google Cloud/Asia Pacific (Tokyo) or AWS/Asia Pacific (Singapore) region, or deploy a self-managed instance from our download center.

Redis Cloud

Start today for free with Redis Cloud

Redis Enterprise Software

Download Redis Enterprise