Redis Series 1-use Redis (download and install) in C ),
This article only describes the resources required to use Redis in Windows + C,Example of using Redis in C #The overall process is divided into three steps and implemented one by one in the order of titles.
1. download and install the Redis Service
You need to download the Redis service and install it in the operating system first. The installation steps are the same as installing other Windows programs. Here we will not spend any time talking about it. Download the applicable Redis service version (Windows 32-or 64-bit installation package) based on your operating system ). After downloading and installing apsaradb for Redis, start the apsaradb for Redis service in Windows.
Redis service: https://github.com/rgl/redis/downloads, directly jump to the download page from here.
2. Download Redis C # Development Library
Redis needs to be used in the C # project. It is actually programmed using a specific development library. The official Redis website provides many development libraries for C # clients. Among them, ServiceStack. Redis is popular and common. That is to say, we actually use the ServiceStack. Redis class library to develop Redis-related functions in the project. Here we will only talk about the use of ServiceStack. Redis.
First you need to download ServiceStack. Redis, ServiceStack. Redis in github is: https://github.com/ServiceStack/ServiceStack.Redis, or directly jump from here to the download page.
After the download is complete, reference the following class libraries to the project.
The above is an implementation method, but in project development, it is possible that team members may download different referenced versions, resulting in exceptions in other developers running the project. Therefore, this method is not recommended. In the Team Project, the most powerful IED visual studio in the universe already has a solution to this problem. I think many people have already guessed it. Yes, that's right. Use NuGet to install ServiceStack. Redis.
First, open the project in. Tool-NuGet Package Manager-Package Manager Console, enter:Install-Package ServiceStack. Redis,Select the project to use RedisPress the Enter key. At this time, vs will automatically download and reference the relevant development library in the project!
3. Development
You can refer to the following simple code example.