Safe Haskell | Safe |
---|---|
Language | Haskell2010 |
- data CachedData a
- fetch :: CachedData a -> IO a
- fetchCached :: CachedData a -> IO (Maybe a)
- createReadOnceCache :: IO a -> IO (CachedData a)
- createTimedCache :: Int -> Bool -> IO a -> IO (CachedData a)
Documentation
data CachedData a Source #
fetchCached :: CachedData a -> IO (Maybe a) Source #
Only fetch data iff it has been cached. Useful for example when a database connection is being cached, and it has to be closed when it is no longer needed, but should not be opened just to be closed.
:: IO a |
|
-> IO (CachedData a) |
Create a cache which will execute an (IO ()) function on demand a maximum of 1 times.
:: Int |
|
-> Bool |
|
-> IO a |
|
-> IO (CachedData a) |
Create a cache with a timeout from an (IO ()) function.