Concurrent-Cache-0.2.2.2: 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 @since 0.1.0.0

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

Only fetch data if it has been cached. @since 0.2.1.0

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. @since 0.2.0.0

createTimedCache Source #

Arguments

:: Int

Timeout in microseconds before the cache is erased

-> 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. @since 0.2.0.0

createCachePassthrough Source #

Arguments

:: a

Variable to hold.

-> CachedData a 

Create a cache variable which simply holds a value with no actual caching at all. @since 0.2.2.2