haxl-0.1.0.0: A Haskell library for efficient, concurrent, and concise data access.

Safe HaskellNone

Haxl.Core.DataCache

Description

A cache mapping data requests to their results.

Synopsis

Documentation

data DataCache Source

The DataCache maps things of type f a to ResultVar a, for any f and a provided f a is an instance of Typeable. In practice f a will be a request type parameterised by its result.

See the definition of ResultVar for more details.

insertSource

Arguments

:: (Hashable (r a), Typeable (r a), Eq (r a), Show (r a), Show a) 
=> r a

Request

-> ResultVar a

Result

-> DataCache 
-> DataCache 

Inserts a request-result pair into the DataCache.

lookupSource

Arguments

:: Typeable (r a) 
=> r a

Request

-> DataCache 
-> Maybe (ResultVar a) 

Looks up the cached result of a request.

showCache :: DataCache -> IO [(TypeRep, [(String, Either SomeException String)])]Source

Dumps the contents of the cache, with requests and responses converted to Strings using show. The entries are grouped by TypeRep.