Redis Actions¶
Actions are the operations (or API operations) that you can perform on Redis by a simple drag and drop and data mapping of elements and values from input trigger, derived values using formulas or a desired constant that you may wish to map.
All of the actions that you see below automate what you can do manually on Redis.
As shown below, you can manage various types of Redis data in response to a trigger event.
Connect iPaaS supports 5 common Redis data types:
- Hash: Redis Hashes are mapped between string fields and string values, so they are the perfect data type to represent objects (e.g. A User with a number of fields like name, surname, age, and so forth)
- List: Redis Lists are simply lists of strings, sorted by insertion order.
- Sets: Redis Sets are an unordered collection of Strings.
- Sorted Sets: Redis Sorted Sets are similar to Redis Sets, non-repeating collections of Strings.
- String: Strings are the most basic kind of Redis value. Redis Strings are binary safe; this means that a Redis string can contain any kind of data. For instance, a JPEG image or a serialized Ruby object.
Set Data As Hash¶
You can use the "Set Data As Hash" action to manage your hash data. There are three commands available for you to manage your hash data:
- HINCR BY: Increment the integer value of a hash field by the given number
- HINCR BY FLOAT: Increment the float value of a hash field by the given amount
- HSET: Set the string value of a hash field
Set Data As List¶
You can use the "Set Data As List" action to manage your list data. There are two commands available for you to manage your list data:
-
LPUSH: Prepend one or multiple elements to a list
-
RPUSH: Append an element to a list, only if the list exists
Set Data As Sets¶
You can use the "Set Data As Sets" action to manage your set data. Using SADD operation, you can add one or more members to a set.
Set Data As Sorted Set¶
You can use the "Set Data As Sorted Set" action to manage your sorted set data. Using ZADD operation, you can add one or more members to a sorted set, or update its score if it already exists.
Set Data As String¶
You can use the "Set Data As String" action to manage your string data. Using ZADD operation. There are two commands available for you to manage your string data:
- INCR: Increment the integer value of a key by one
- SET: Set the string value of a key
Set up Redis action in your workflow¶
To use a Redis action, you need to:
- Pick a Redis action with the data type that you want to operate on.
- Set up Redis Connection.
- Choose a command for operating your Redis data.
- Set up arguments required for the Redis Command.
When a new customer is created in Magento 2.x, as shown in the example above, the Email
of the new member will be saved into Redis sets with the set name as MemberList
.