TCache-0.10.0.2: A Transactional cache with user-defined persistence

Safe HaskellNone

Data.TCache.Memoization

Description

 

Synopsis

Documentation

cachedByKey :: (Typeable a, Executable m, MonadIO m) => String -> Int -> m a -> m aSource

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

cachedp :: (Indexable a, Typeable a, Typeable b) => (a -> b) -> a -> bSource

a pure version of cached

addrStr :: MonadIO m => a -> m StringSource

return a string identifier for any object

addrHash :: MonadIO m => a -> m IntSource

return a hash of an object

class Executable m whereSource

to execute a monad for the purpose of memoizing its result

Methods

execute :: m a -> aSource