About compared with memcached and redis

Outline

redisIs a nosqldatabase, his data is stored in memory, and rediscan synchronize the timing of the in-memory data to disk, that data can be persistent, and compared him memcachedto support more data structure ( string, list列表[队列和栈], set[集合], sorted set[有序集合], hash(hash表)). Related reference documentation: http://redisdoc.com/index.html

redis usage scenarios:

  1. Login session storage: Store in the redismiddle, and memcachedcompared the data will not be lost.
  2. Top version / counter: for example, some of the show class project, there is often some former anchor ranked number names. There are some articles to read the amount of technology, or Sina microblogging number of points such as praise.
  3. As the message queue: such celeryis used redisas an intermediary.
  4. Online Now: still show the previous example, the current system will show how much the number of online.
  5. Some commonly used data cache: Such as our BBSforum, the plate does not change often, but every access from every home mysqlget in, you can rediscache up in, not every request database.
  6. The first 200 articles or reviews cache cache: general users visit the website, only the front part of the article or view a comment, you can put in front of 200 articles and corresponding comments cached. Users access to over, access the database, and after more than 200 articles, put the article before deleting.
  7. Friends relationship: friendship use microblogging redisto achieve.
  8. Publish and subscribe functions: can be used to make chat software.

    redisAnd memcachedthe comparison:

      memcached repeat
    Types of Pure in-memory database RAM disk synchronization database
    type of data When necessary to define the data type fixed value Do not need
    Virtual Memory not support stand by
    Expiration Policy stand by stand by
    Storing data security not support Data may be synchronized to the dump.db
    Disaster Recovery not support You can restore data disk into memory
    distributed stand by Master-slave synchronization
    Subscriptions and publishing not support stand by

Guess you like

Origin www.cnblogs.com/xshan/p/12236505.html