Learn Redis in need to organize and configure more things, resources are more scattered! This time the main is to integrate knowledge, the development process needed to integrate the resources, but also to facilitate the future involved in this area of knowledge, will be a lot of wasted time to find these resources!
A. Redis (NoSQL database):
Redis is primarily a database for storing key-value pairs of data, which is primarily optimized, and automatically expires data. Unlike memcached, where redis data exists on a native hard disk, memcached is in memory.
Redis has Windows edition and Linux edition, the usual test development basic use of Windows Edition, in the formal project development process, generally with Linux
Two. Installation and configuration of Redis:
For the installation of Redis (Windows edition), refer to the official tutorial configuration,
This was started by Server.exe:http://www.redis.net.cn/tutorial/3503.html
Win64 can download this with service (suffix is. msi):https://github.com/MSOpenTech/redis/releases
Win32 Download Select suitable version:https://github.com/MSOpenTech/redis/releases?after=win-2.8.2102
. NET driver:https://github.com/ServiceStack/ServiceStack.Redis/tree/master/lib
Drivers need to download the following four:
Three. Code to connect to Redis:
Depending on the business, make the appropriate connection configuration, here are the simplest connection configuration:
classRedismanager { Public StaticPooledredisclientmanager Clientmanager {Get;Private Set; } StaticRedismanager () {redisclientmanagerconfig clientmangerconfig=NewRedisclientmanagerconfig (); Clientmangerconfig.maxwritepoolsize= -; Clientmangerconfig.maxreadpoolsize= -; Clientmanager=NewPooledredisclientmanager (New string[] {"127.0.0.1"},New string[] {"127.0.0.1"}, Clientmangerconfig); } }
Set and read values:
using (client = RedisManager.clientManager.GetClient ()) { string str= client. set<string> ("key","value", Expiretime) ; // The first parameter key in parentheses, the second value is the value, and the third is the expiration Time }
About Redis knowledge can also refer to this blog, indeed also written very good:http://www.cnblogs.com/yangecnu/p/Introduct-Redis-in-DotNET.html
Four. Redis database management tools and considerations during use:
Redis Database management tool:http://redisdesktop.com/download
You can easily see the various types of values stored in Redis key.
When using Redis, be aware that:
1. Avoid key collisions when a lot of data is written to Redis: Key collisions cause the values of keys of the same name to be overwritten.
Avoid key conflicts: for example, you can add a prefix to the name of the key
2.Redis is to share the stored key value to the storage space, a write, B can be read out, a write, B can also be covered out
Redis Simple configuration and use