apart-0.1.1: Get all your structure and rip it apart.

Safe HaskellSafe
LanguageHaskell2010

Data.Apart.Usage.LRU

Synopsis

Documentation

type LRU a = Segment Binary a Source #

In this usage example we'll try to implement LRU cache. This policy discards the least recently used items first, so we need to add priority for the most recently used elements. Very resembles behavoir of Splay trees, actually.

cache :: Ord a => a -> LRU a -> LRU a Source #

Insert sortable value to cache, aftear that, value moved to root