The lrucaching package

[ Tags: bsd3, library, unknown ] [ Propose Tags ]

Please see

[Skip to Readme]


Versions 0.1.0, 0.2.0, 0.2.1, 0.3.0, 0.3.1, 0.3.2
Change log
Dependencies base (>=4.7 && <5), base-compat (==0.9.*), deepseq (==1.4.*), hashable (==1.2.*), psqueues (==0.2.*), vector (>=0.11 && <0.13) [details]
License BSD3
Copyright 2016
Author Moritz Kiefer
Category Unknown
Home page
Source repository head: git clone
Uploaded Fri Jun 16 07:00:31 UTC 2017 by cocreature
Distributions LTSHaskell:0.3.2, NixOS:0.3.2, Stackage:0.3.2, Tumbleweed:0.3.2
Downloads 416 total (13 in the last 30 days)
Rating 0.0 (0 ratings) [clear rating]
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2017-06-16 [all 1 reports]
Hackage Matrix CI




Maintainer's Corner

For package maintainers and hackage trustees

Readme for lrucaching-0.3.2

[back to package description]


Build Status Hackage

An implementation of lrucaches based on a blogpost by Jasper Van der Jeugt.

This package has no relation to lrucache. I created it because there were bugs in lrucache and the maintainer was not responding to issues.


The easiest way to use this library is to use Data.LruCache.IO. This wraps the cache in a Data.IORef, a mutable varible in the IO monad.

e.g. To create a 1000-item cache, keyed by Integer, storing String:

import qualified Data.LruCache.IO as LRU

newCache :: IO (LRU.LruHandle Integer String)
newCache = LRU.newLruHandle 1000

cachedLookup cache key = LRU.cached cache key $
    -- insert some something expensive
    return $ show key

main :: IO ()
main = do
    cache <- newCache
    cachedLookup cache 123 >>= putStrLn