Redis is an open source API that is written in ANSI C, supports the web, can be persisted in memory, key-value databases, and provides multiple languages. It provides a variety of mainstream languages for the client, easy to use, while Redis supports master-slave synchronization.
In addition to regular numeric values or strings, Redis's key values can also be in one of the following forms: Hash,list,set and Zset (sorted set). Redis supports advanced atomic operations such as the intersection of lists, sets, or ordered sets, set, and difference sets, and, if the type of the key value is a normal number, Redis provides self-increment atomic operations.
All structures that can be described using relational database theory can be implemented using the data structure of Redis. With MySQL, when the data size is very large, complex query operations require the use of table affinity technology, which is time consuming. Key-value is stored in Redis, and locating a key requires only O (1) operation.
Redis typically stores data in memory or is configured to use virtual memory. Data persistence can be achieved in two ways:
– Use Snapshots (filesnapshotting) to keep data in-memory written to disk;
– Log each update (APPEND-ONLY) using a log method similar to MySQL.
Redis supports synchronizing data to multiple slave libraries, which is useful for improving read performance, and master-slave replication allows multiple slave servers to have the same database copy as master server. Configuring the slave server is simple, just add the configuration to the configuration file:
slaveof Master Redis service IP Port
Support for C, C + +, C #, Java, Lua, Perl Javascript, Objective-c, PHP, Ruby, Python, go and other languages; C + + official recommended client is:Hiredis. (Example below)
Reference:
? Chinese official website: http://www.redis.cn/
? How to use Redis tools: http://dmouse.iteye.com/blog/811455
? Redis Master-slave configuration: http://www.cnblogs.com/liuling/p/2014-4-19-02.html
Key-value Database: Redis Cache Service