Comparison between redis and memcached.
1. memcached is multithreading, while redis uses a single thread.
2. memcached uses the pre-allocated memory pool. redis uses the on-site memory application method to store data and can configure virtual memory.
3. redis can achieve persistence, master-slave replication, and fault recovery.
4. memcached is a simple key and value, but redis supports many data types.
Redis currently provides five data types: String, list, hash, set, and zset (sorted set)
File concurrency (log processing): the solution is to first put data in the queue, and then start a thread to retrieve data from the queue and then write it to the file.
Redis master-slave replication: one master can have multiple slave instances, and one slave can have multiple slave instances. In this way, a powerful multi-level server cluster architecture is formed.
List <userinfo> List = new list <userinfo> () {New userinfo () {username = "Lisi", userpwd = "111"}, new userinfo () {username = "wangwu", userpwd = "123 "}};
Client. Set <list <userinfo> ("list", list );
List <userinfo> userinfolist = client. Get <list <userinfo> ("list ");
Foreach (userinfo in userinfolist)
{
Console. writeline (userinfo. username );
}