2017-07-06 41 views
0

redis如何在内部执行以下功能。memcache和redis的内部工作方式不同

  1. 内存管理: 我知道内存缓存不使用固定大小和帧和内frame.How不同redis的存储器管理是 固定大小的板坯存储器管理?
  2. 对于驱逐memcache使用LRU。为此,每个memcache节点都有Map和双链表。在读写操作中,两个数据结构都使用全局锁访问。 Redis如何执行此操作?由于这些数据结构的Redis单线程锁定不是必需的。

回答

0

首先,我会建议你通过this post。 在该stackoverflow答案,您可以看到您的第一个点“内存管理”的答案以及许多其他详细信息。 为了您的第二点休息,我想告诉您可以从可以管理不同可用行为的位置检查redis的默认配置文件。

这段代码在redis configuration file提到:

# MAXMEMORY POLICY: how Redis will select what to remove when maxmemory 
# is reached. You can select among five behaviors: 
# 
# volatile-lru -> remove the key with an expire set using an LRU algorithm 
# allkeys-lru -> remove any key according to the LRU algorithm 
# volatile-random -> remove a random key with an expire set 
# allkeys-random -> remove a random key, any key 
# volatile-ttl -> remove the key with the nearest expire time (minor TTL) 
# noeviction -> don't expire at all, just return an error on write operations 

希望它会帮助你。如果我错过了一些东西,请稍后再更新。

相关问题