lrucaching 0.3.1 → 0.3.2
raw patch · 2 files changed
+28/−4 lines, 2 filesdep ~QuickCheckPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: QuickCheck
API changes (from Hackage documentation)
Files
- README.md +24/−0
- lrucaching.cabal +4/−4
README.md view
@@ -11,3 +11,27 @@ [lrucache](https://hackage.haskell.org/package/lrucache). I created it because there were bugs in `lrucache` and the maintainer was not responding to issues.+++## Usage++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`:++```haskell+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+```
lrucaching.cabal view
@@ -1,5 +1,5 @@ name: lrucaching-version: 0.3.1+version: 0.3.2 synopsis: LRU cache description: Please see README.md homepage: https://github.com/cocreature/lrucaching#readme@@ -13,7 +13,7 @@ extra-source-files: CHANGELOG.md README.md cabal-version: >=1.10-tested-with: GHC == 7.8.4, GHC == 7.10.3, GHC == 8.0.1+tested-with: GHC == 7.8.4, GHC == 7.10.3, GHC == 8.0.2 library hs-source-dirs: src@@ -41,9 +41,9 @@ , containers >= 0.5 && < 0.6 , deepseq , hashable- , hspec >= 2.2 && < 2.4+ , hspec >= 2.2 && < 2.5 , lrucaching- , QuickCheck >= 2.8 && < 2.10+ , QuickCheck >= 2.8 && < 2.11 , transformers >= 0.4 && < 0.6 default-language: Haskell2010