processCommand方法调用链路:
- networking.c【readQueryFromClient-->processInputBuffer-->processCommandAndResetClient-->processCommand】
- -->freeMemoryIfNeededAndSafe
- -->freeMemoryIfNeeded ? // evict.c?
- -->计算需要释放内存量
- -->根据配置的驱逐策略来生释放缓存:
- server.maxmemory_policy & (MAXMEMORY_FLAG_LRU|MAXMEMORY_FLAG_LFU) || server.maxmemory_policy == MAXMEMORY_VOLATILE_TTL
- -->evictionPoolEntry ?evictionPoolPopulate 驱逐key Pool计算方式 ?如何完成采样的呢? 下次阅读源码>>>> ? ? evictionPoolPopulate(i, dict, db->dict, pool);
- -->确定需要移除的key, del or unlink and how to append aof 涉及到不同算法的来find key
- -->直到内存降低到水平线下面;
|