Using Redis as Cache on-Premises
In this recipe, we will learn how to install Redis on Windows, and use it as a cache in-memory system with ASP.NET Core MVC applications.
Getting ready
We will download Redis for Windows, and launch VS 2017 to create an empty web application.
How to do it...
- First, let's launch http://redis.io:
![](https://static.packt-cdn.com/products/9781785886751/graphics/0283566e-ee70-4fd7-a943-190ddf691c91.png)
- Next, we go to theÂ
Download |Â
Windows
section:
![](https://static.packt-cdn.com/products/9781785886751/graphics/811de95d-10df-495f-9d61-aa1a6a5fd32e.png)
- We are automatically redirected to a GitHub project named
MSOpenTech/redis
:
![](https://static.packt-cdn.com/products/9781785886751/graphics/a5c004c0-24bd-4f48-9e1e-53cd4a84067c.png)
- In the followingÂ
Redis on Windows
section, we will find a link for anÂMSI installer
:
![](https://static.packt-cdn.com/products/9781785886751/graphics/16223109-7cc4-434d-b607-e2f545887ba1.png)
- Here is the download page for the MSI, but we can also download the binaries for Linux or macOS:
![](https://static.packt-cdn.com/products/9781785886751/graphics/681420b5-99af-4f93-abb8-fe51f4b57baf.png)
- After downloading, we click on the installer:
![](https://static.packt-cdn.com/products/9781785886751/graphics/b9f7b458-f4bb-4fa7-8f84-d2c3c01c8119.png)
- Let's select the destination folder for the Redis server:
![](https://static.packt-cdn.com/products/9781785886751/graphics/a4fc1e22-c28b-4985-9b81-c9f5d777cf05.png)
- Next, we select the port number, where we will request Redis and add an exception to the Windows Firewall:
![](https://static.packt-cdn.com/products/9781785886751/graphics/1d897a37-a425-48dc-a6de-525871bc7fbe.png)
- Next, we add the memory limit:
![](https://static.packt-cdn.com/products/9781785886751/graphics/05fbfe72-84ee-49f6-9c4f-8609f7fdf703.png)
- Redis is finally installing:
![](https://static.packt-cdn.com/products/9781785886751/graphics/9115c19f-1f9c-4b6b-b9a7-bab134d298aa.png)
- Now we will run Redis as a service. To do that, let's launch the
Services
console on Windows by typingservices...