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

Safe HaskellNone
LanguageHaskell2010

Haxl.Core.DataCache

Description

A cache mapping data requests to their results.

Synopsis

Documentation

data DataCache res 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.

empty :: DataCache res Source

A new, empty DataCache.

insert Source

Arguments

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

Request

-> res a

Result

-> DataCache res 
-> DataCache res 

Inserts a request-result pair into the DataCache.

lookup Source

Arguments

:: Typeable (req a) 
=> req a

Request

-> DataCache res 
-> Maybe (res a) 

Looks up the cached result of a request.

showCache :: DataCache ResultVar -> 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.