Concurrent-Cache 0.2.2.2 → 0.2.2.3
raw patch · 2 files changed
+8/−3 lines, 2 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
Concurrent-Cache.cabal view
@@ -2,7 +2,7 @@ -- documentation, see http://haskell.org/cabal/users-guide/ name: Concurrent-Cache-version: 0.2.2.2+version: 0.2.2.3 synopsis: A Cached variable for IO functions. description: This package allows for caching IO functions, either on a timeout or designed to only fetch once.
Control/Concurrent/Cache.hs view
@@ -5,7 +5,7 @@ import System.Mem.Weak (deRefWeak, Weak) import Control.Monad (when, liftM) -data Timeout = TimeSinceCreation Int | TimeSinceLastRead Int +data Timeout = TimeSinceCreation Int | TimeSinceLastRead Int type TimedCachedDataMVar a = MVar (Maybe ThreadId, IO a, Maybe a) data CachedData a = TimedCachedData Timeout (TimedCachedDataMVar a) (Weak (TimedCachedDataMVar a))@@ -13,6 +13,7 @@ | CachePassthrough a -- |Only fetch data if it has been cached.+-- -- @since 0.2.1.0 fetchCached :: CachedData a -> IO (Maybe a)@@ -45,6 +46,7 @@ fetchCached (CachePassthrough a) = return $ Just a -- |Fetch data from a cache+-- -- @since 0.1.0.0 fetch :: CachedData a -> IO (a)@@ -75,16 +77,18 @@ -- |Create a cache which will execute an (IO ()) function on demand -- a maximum of 1 times.+-- -- @since 0.2.0.0 createReadOnceCache :: IO (a) -- ^ @Fetcher@, the function that returns the data which should- -- be cached. + -- be cached. -> IO (CachedData a) createReadOnceCache action = do var <- newMVar $ Left action return $ ReadOnceCachedData var -- |Create a cache with a timeout from an (IO ()) function.+-- -- @since 0.2.0.0 createTimedCache :: Int -- ^ @Timeout@ in microseconds before the cache is erased@@ -107,6 +111,7 @@ -- |Create a cache variable which simply holds a value with no actual -- caching at all.+-- -- @since 0.2.2.2 createCachePassthrough :: a -- ^ @Variable@ to hold.