Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- writeCached :: (Typeable b, Typeable a, Indexable a, Executable m) => a -> (a -> m b) -> b -> Integer -> STM ()
- cachedByKey :: (Typeable a, Executable m, MonadIO m) => String -> Int -> m a -> m a
- cachedByKeySTM :: (Typeable a, Executable m) => String -> Int -> m a -> STM a
- flushCached :: String -> IO ()
- cachedp :: (Indexable a, Typeable a, Typeable b) => (a -> b) -> a -> b
- addrStr :: a -> String
- class Executable m where
- execute :: m a -> a
Documentation
writeCached :: (Typeable b, Typeable a, Indexable a, Executable m) => a -> (a -> m b) -> b -> Integer -> STM () Source #
memoize the result of a computation for a certain time. This is useful for caching costly data such web pages composed on the fly.
time == 0 means infinite
cachedByKey :: (Typeable a, Executable m, MonadIO m) => String -> Int -> m a -> m a Source #
Memoize the result of a computation for a certain time. A string key
is used to index the result
The Int parameter is the timeout, in second after the last evaluation, after which the cached value will be discarded and the expression will be evaluated again if demanded . Time == 0 means no timeout
cachedByKeySTM :: (Typeable a, Executable m) => String -> Int -> m a -> STM a Source #
flushCached :: String -> IO () Source #
cachedp :: (Indexable a, Typeable a, Typeable b) => (a -> b) -> a -> b Source #
a pure version of cached
addrStr :: a -> String Source #
given a string, return a key that can be used in Indexable instances
Of non persistent objects, such are cached objects (it changes fron execution to execution)
. It uses addrHash
class Executable m where Source #
to execute a monad for the purpose of memoizing its result
Instances
Executable Identity Source # | |
Defined in Data.TCache.Memoization | |
Executable IO Source # | |
Defined in Data.TCache.Memoization |