How to use Azure Redis Cache in C#

Redis is an open source, feature rich, in-memory database and caching engine that can be used to store and retrieve data in your applications. Azure Redis Cache is based on this popular database, providing a powerful and secure way to cache your application’s data in the Azure cloud.
Azure Redis Cache is a distributed cache service that can be used to share data across instances and applications running in Azure. You can use Azure Redis Cache in .Net, ASP.Net, Java, Node.js, and Python. In this article we will examine how we can work with Azure Redis Cache in C#.
First off, you should create an Azure account if you don’t have one. You can then follow the steps outlined here to create and configure Redis Cache in Azure.
Install the StackExchange.Redis client
Assuming you are all set to use Azure Redis Cache, it’s finally time for coding. Create a Console Application project in Visual Studio and then install the popular Redis client for .Net called StackExchange.Redis via the NuGet Package Manager UI. Alternatively, you can install this package from the NuGet Package Manager Console using the following command.