Reading Time: 5 minutes

REmote DIctionary Server (REDIS) is an open source, in-memory data structure store which was created by Salvatore Sanfilippo in 2009 for real-time web analytics. This open source project had been sponsored by VMware and Pivotal Software, and since June 2015, has been sponsored by Redis Labs. According to Redis Day TLV 2016, Redis has gained lots of adoption in thousands of companies including American Express, Atlassian, Ariba, Facebook, Intuit, TripAdvisor, Twitter, and Verizon.

You can use Redis to cache a user profile, create a leaderboard, track real-time activities on a website, implement a spam filtering system, use it as a message queue, and more. At MuleSoft, we have seen customers use Redis as a cache storage layer while using MongoDB as a persistent message storage layer, to process huge amounts of payroll and employee data with Redis Cluster, and as a NoSQL database. To support the growing number of customers leveraging Redis, we are thrilled to release the Anypoint Connector for Redis today.

latest report
Learn why we are the Leaders in API management and iPaaS

Here is a quick example of how to use the Redis Connector, compatible with Redis 2.8, 3.0 and 3.2. This demo app allows you to test basic operations of Redis Connector. The app consists of two flows; the first flow shows 12 different operations which will be triggered by your choice, the second flow shows you a web page where you can pick an operation.

Redis
Redis Flow2

Let’s configure this Redis Connector first. Go to Global Elements, and find “Redis.” After selecting “Redis,” click on “Edit”.

Redis Configuration2

In the Redis: Configuration, you can specify the configuration of your Redis server. You could directly add your Redis Server information in the configuration, but I recommend that you use the properties file to add your configuration information. Since I’m running a Redis Server locally on my Mac, the configuration of my Redis Server I will use looks like this:

Redis server

config.host=localhost
config.connectionTimeout=60000
config.port=6379
After you complete the configuration for your Redis environment, run the app. When you open up a browser and hit localhost:8081, your browser will show the following page.

localhost:8081

Since implementing a leaderboard is one of main use cases, I’d like to show an example of using a sorted set. When you scroll down on the webpage, you will see the following page.

redis sort

I added the following data to a sorted set called “Max the Mule.”

KeyValueScore
Max the MuleNathan50
Max the MuleAnton70
Max the MuleAshley110
Max the MuleAlex150

I’m only interested in those who scored higher than 100, so when I put the following information in “Get range by score”, Redis will show only Ashley and Alex who scored more than 100.

Screen Shot 2016-06-29 at 4.22.12 PM

Screen Shot 2016-06-29 at 4.22.21 PM

For new users, try the above example to get started, and for others, please share with us how you are planning to use the Redis Connector! Also, explore the Anypoint Exchange to see other resources you can leverage today.