1)可以想到,在對(duì)于cache,我們需要維護(hù) key -> value 的關(guān)系 2)而為了實(shí)現(xiàn)LRU,我們又需要一個(gè)基于時(shí)間的優(yōu)先級(jí)隊(duì)列,來維護(hù) timestamp -> (key, value) 的關(guān)系 3)當(dāng)cache 中的記錄數(shù)達(dá)到一個(gè)上界maxsize時(shí),需要將timestamp 最小的(key,value) 出隊(duì)列 4) 當(dāng)一個(gè)(key, value) 被命中時(shí),實(shí)際上我們需要將它...
www.dbjr.com.cn/article/556...htm 2025-5-29