Azure Redis Cache

Azure provides the popular Redis Cache service in all the service plans.

History of Redis Cache

Redis Cache is an Open Source caching framework.  Its popularity among developers made Azure adapt it and available to Azure development platform.

Advatages of Redis Cache

Following are the advantages of Redis Cache:

  1. Highly Scalable Redis Cache can be horizontally scaled based on demand
  2. Low Latency Improved availability through edge servers makes low latency in calls
  3. Highly Secure Redis cache provides better security than traditional caches.
  4. Better Data Structure Redis Cache provides storage of cache as key-value pair as strings, hashes, lists, sets and sorted sets.
  5. Better Atomicity through Transactions feature
  6. Persistence Redis Cache allow persisting data into database.

Creating a Redis Cache

Open Azure Portal and choose Create a resource option.  Search for Redis Cache and you will get the following option.

image

In the appearing window we can specify the cache name.

image

Programming

We can use Redis Cache in application as below:


// Open Connection
ConnectionMultiplexer connection = ConnectionMultiplexer.Connect("YOURCACHENAME.redis.cache.windows.net, ssl=true,password=YOURPOASSWORD”);

IDatabase cache = connection.GetDatabase();

// Create Value
cache.StringSet("mykey", "myvalue");
// Retrieve Value
string value = cache.StringGet("mykey");

Access Keys

You can get the Access Keys from the Azure Portal window.

image 
image 

Summary

In this post we have explored about Redis Cache. 

Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s