Concurrent-Cache-0.2.2.0: A Cached variable for IO functions.

Safe HaskellSafe
LanguageHaskell2010

Control.Concurrent.Cache

Synopsis

Documentation

fetch :: CachedData a -> IO a Source #

Fetch data from a cache

fetchCached :: CachedData a -> IO (Maybe a) Source #

Only fetch data if it has been cached.

createReadOnceCache Source #

Arguments

:: IO a

Fetcher, the function that returns the data which should be cached.

-> IO (CachedData a) 

Create a cache which will execute an (IO ()) function on demand a maximum of 1 times.

createTimedCache Source #

Arguments

:: Int

Timeout in microseconds before the cache is erased, 0 to disable emptying of the cache

-> Bool

resetTimerOnRead, if true the timeout will be reset every time the cache is read, otherwise it will only be reset when the cached value is set.

-> IO a

Fetcher, the function that returns the data which should be cached. If Timeout is not set to zero, this function must be allowed to be called more than once.

-> IO (CachedData a) 

Create a cache with a timeout from an (IO ()) function.