2017-07-06 24 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 

希望它會幫助你。如果我錯過了一些東西,請稍後再更新。

相關問題