@hackage / caching-vault

A vault-style cache implementation

Latest0.1.0.0

About

Metadata

  • Last updated , by AlexanderThiemann
  • License BSD-3-Clause
  • Maintained by: Alexander Thiemann <mail@thiemann.at>

  • Lottery factor: 0

Links

Installation

Readme

caching-vault

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

Example

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)