caching-vault: A vault-style cache implementation

[ bsd3, data, library ] [ Propose Tags ]

Allows a central cache for arbitrary values with expiry dates

[Skip to Readme]


[Index] [Quick Jump]


Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees


  • No Candidates
Versions [RSS]
Dependencies base (>=4.7 && <5), stm, stm-containers, text, time [details]
License BSD-3-Clause
Copyright 2021 Alexander Thiemann
Author Alexander Thiemann
Maintainer Alexander Thiemann <>
Category Data
Home page
Bug tracker
Source repo head: git clone
Uploaded by AlexanderThiemann at 2021-01-03T03:03:47Z
Distributions NixOS:
Downloads 238 total (6 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2021-01-03 [all 1 reports]

Readme for caching-vault-

[back to package description]


A simple vault style cache implementation based on stm-containers.


import Data.Time
import qualified Data.Cache.Vault as C

main :: IO ()
main =
  do cache <- C.newCache
     let key :: C.Key String
         key = C.mintLabeledKey "foo"
     C.insert key Nothing "cached value" cache
     now <- getCurrentTime
     value <- C.lookup now key cache
     case value of
       Nothing -> putStrLn "Cache miss"
       Just val -> putStrLn ("Cache value is: " <> val)