search

Home  >  Q&A  >  body text

redis - 如何对列表进行合理的缓存

在使用redis做缓存的时候,缓存单个的数据是比较容易的,那么如何话缓存列表比较合适呢?因为列表可能涉及更新和删除,还有分页。

大家讲道理大家讲道理2796 days ago1031

reply all(2)I'll reply

  • 迷茫

    迷茫2017-04-24 09:13:37

    Redis itself is an in-memory database, and the data will be loaded into the memory, and the data will be updated to the disk according to the customized persistence strategy.
    So you don’t have to worry about disk IO caused by a large number of DML operations

    reply
    0
  • 伊谢尔伦

    伊谢尔伦2017-04-24 09:13:37

    It depends on the specific business.
    You can cache only the ID of a single piece of data in the list, and then you don’t need to worry about the update.
    When deleting a single piece of data, there must be a mechanism to delete the piece of data in the list cache, and the deletion operation should be infrequent. If so, you can delete them all.

    reply
    0
  • Cancelreply