io-memoize-1.1.1.0: Memoize IO actions

Safe HaskellSafe
LanguageHaskell98

Control.Concurrent.Cache

Synopsis

Documentation

data Cache a #

A thread-safe write-once cache. If you need more functionality, (e.g. multiple write, cache clearing) use an MVar instead.

Instances

Eq (Cache a) # 

Methods

(==) :: Cache a -> Cache a -> Bool #

(/=) :: Cache a -> Cache a -> Bool #

newCache :: IO (Cache a) #

Create an empty cache.

fetch :: Cache a -> IO a -> IO a #

Fetch the value stored in the cache, or call the supplied fallback and store the result, if the cache is empty.