The initial Redis and simple to use

Initial Redis:

redis is a key-value storage system . And Memcached Similarly, it supports relatively more stored value type, comprising a string (string), List ( list ), SET (set), zset (sorted set - ordered set) and hash (hash type). These data types are supported push / pop, add / remove and on the intersection and union, and difference richer operation, and these operations are atomic. On this basis, redis support a variety of different ways of sorting. Like with memcached, in order to ensure efficiency, the data is cached in memory. Redis difference is periodically updated in the data written to disk or to modify the operation of writing additional log file, and on this basis realize the master-slave (master and slave) synchronization.

Redis is a key-value high-performance database. redis appears, to a large extent compensated for memcached lack of such key / value store, it can play a very good complement to relational database in some situations. It provides Java, C / C ++, C #, PHP, JavaScript, Perl, Object-C, Python, Ruby, Erlang and other clients, very easy to use.  [1] 
Redis supports master-slave synchronization. Data can be synchronized from the primary server to an arbitrary number from the server, the server may be associated with the primary server from another server. This allows the tree Redis single executable copy. Intentionally or unintentionally, can save the data write operation. Since the full implementation of the publish / subscribe mechanism, so that the database synchronization from a tree anywhere, can subscribe to a channel and receive the full message master server publishing record. Synchronization scalability and redundancy data useful for a read operation.
For details, see ==> https://baike.baidu.com/item/Redis/6549233?fr=aladdin

Redis features:

  • Memory database, speed, and also supports persistent data, data in memory can be saved to disk, reboot to load when you can be reused.
  • Redis only supports simple key-value data types, while also providing a storage list, set, zset, hash and other data structures.
  • Redis supports backup data, i.e., data backup master-slave mode.
  • Support Services

Redis advantages:

  • High performance - Redis can read as fast as 110,000 times / s, write speed is 81000 times / s.
  • Rich data types - Redis supports binary case Strings, Lists, Hashes, Sets and Ordered Sets the data type of the operation.
  • Atom - Redis All operations are atomic, and atomic Redis supports several operations performed after the merger. (Affairs)
  • Feature-rich - Redis also supports publish / subscribe, notification, key expiration and so on characteristics.

Redis and other key-value store What is the difference?

  • Redis has a more complex data structure and provide atomic operations on them, which is different from the other databases evolutionary path. Meanwhile Redis data types are based on the basic data structure transparent to the programmer, without the need for additional abstraction.
  • Redis running in memory, but can be persisted to disk, so that when the high-speed read and write memory tradeoffs different data sets because the data can not be greater than the amount of hardware memory. Another advantage of in-memory databases are, compared to the same complex data structures, operate in a very simple memory on the disk, so you can do a lot of internal Redis highly complex matter. Meanwhile, in terms of their compact disk format to generate additional way, because they do not require random access.
 Reference: https: //www.jianshu.com/p/238372c25669
 
 
Simple to use Redis:
  key operation keys:
    exists key test whether the specified key exists
    del key1 key2key3 remove the given key
    type key to view the value of the type specified key
    Returns the specified keys pattern matching pattern all key
    rename oldkey new key to the specified key to change the name
    dbsize returns the current number of key database
    expire key seconds specify an expiration time for the key        
    TTL expired key return key remaining seconds
    select db-index database selection (select 1: Select the second database)
    move key db-index from the current database key to move to the specified database
    flushdb delete all key current library
    flushall delete all key all libraries
 
......... have time to update

Guess you like

Origin www.cnblogs.com/FavoriteMango/p/11424347.html