cached-io-0.1.0.1: A simple library to cache a single IO action with timeout.

Safe HaskellSafe-Inferred
LanguageHaskell2010

Control.Concurrent.CachedIO

Synopsis

Documentation

cachedIO :: NominalDiffTime -> IO a -> IO (IO a) Source

Cache an IO action, producing a version of this IO action that is cached for interval seconds. Immediately initialize the cache with the given IO action.

The outer IO is responsible for setting up the cache. Use the inner one to either get the cached value or refresh, if the cache is older than interval seconds.