Redis for Windows (C # Cache) installation and use
Objective
I wrote two simple articles about memcached cache in the previous period, but of course it's just how you get started. Recently these two days discovered Redis this magical thing, must have seen before, because is a side dish, also really did not pay attention to what it is to do, but recently found that it is also a cache artifact Ah, so they come to a simple introduction to learn.
Get started with couchbase--memcached cache in ASP. http://www.cnblogs.com/aehyok/p/3436721.html
Use the couchbase--memcached cache with the http://www.cnblogs.com/aehyok/p/3438838.html in ASP.
Download installation
Via https://github.com/mythz/redis-windows Here you can download it directly and unzip it
Re-unzip
Now I have set up a Redis folder on e-Disk (it is also possible to build on other disks). Then copy all the files below the extracted folder to the Redis folder.
Server-side Redis-server.exe client Redis-cli.exe
First we can now open the service view
The default port is 6379. The configuration profile is not configured so the default configuration is used.
Then open the client under the appropriate folder
The input command set test "Aehyok" is the equivalent of adding a key to Test,value to Aehyok to redis the data.
Enter get test again to retrieve "Aehyok".
Of course you can also download the relevant version from other addresses. Version Https://github.com/dmajkic/redis/downloads under 32-bit or 64-bit operating systems under windows
Using Redis in C #
First open Visual Studio to build a simple console application, I'm using the VS2013 version here for the time being.
The Redis common component Servicestack.redis is then installed through NuGet.
The appropriate references are added to the project after the installation is complete
Gets the Test:aehyok key-value pair previously set by code.
Redisclient Client = new Redisclient ("127.0.0.1", 6379); String str = client.get<string> ("test"); Console.WriteLine ("Test key-value pair previously set by client: {0}", str); Console.ReadLine ();
You can also set the key-value pairs directly from the code and make the appropriate values.
Specify the configuration file
We can use the cmd command to set the configuration profile to a step-by.
1. First open the cmd command, and then enter the drive letter where the installation file is located, by reading you can find that I placed the installation file on the E drive. "E:"
2. Step two Enter the folder directory where the installation files are located "CD Redis"
3. The third step is to enter the following command Redis-server.exe redis.conf, the front is the server executable, followed by the specified configuration file.
4. By repeating the above three steps and can modify the prot port number in redis.conf to test, I change here to 6666.
If the test is found to be successful.
Summarize
A simple primer, from download to installation, to the simplest small example used in the project. The next article is mainly about how to configure the Redis configuration file under learning.
Suddenly think how to use this as a Windows system of the self-boot service, do not know if there are children shoes have been used, welcome advice.
Http://www.cnblogs.com/shanyou/archive/2013/01/17/redis-on-windows.html This method needs to compile the project, and the C + + project is more troublesome. I have used SRVINSTW to make but in this machine has not been produced successfully, welcome the big God pointing twos.
Redis for Windows (C # Cache) installation and use