private void onMiss ( long key ) { Node node = new Node ( key ) ; node . type = QueueType . HOT ; node . appendToTail ( headHot ) ; data . put ( key , node ) ; sizeHot ++ ; if ( sizeHot > maxHot ) { Node demoted = headHot . next ; demoted . remove ( ) ; sizeHot -- ; demoted . appendToTail ( headCold ) ; demoted . type = QueueType . COLD ; sizeCold ++ ; evict ( ) ; } }
Adds the entry to the cache as HOT overflowing to the COLD queue and evicts if necessary .