Handbook Glossary
factorcode.org
lifo-cache


Vocabulary
lru-cache

Definition
USING: linked-assocs ;

IN: lru-cache

TUPLE: lifo-cache < linked-assoc max-size ;


Methods
USING: accessors kernel lru-cache ;

M: lifo-cache clone
[ assoc>> clone ] [ dlist>> clone ] [ max-size>> ] tri
lifo-cache boa ;


USING: accessors assocs deques generic kernel
linked-assocs.private lru-cache math sequences.private ;

M: lifo-cache set-at
dup max-size>> [
over assoc>> assoc-size <= [
dup
[ dlist>> pop-back first-unsafe ] [ assoc>> ]
[ dlist>> ] tri (delete-at)
] when
] when* M\ lifo-cache set-at (call-next-method) ;