glue-core-0.4.4: Make better services and clients.

Safe HaskellNone
LanguageHaskell2010

Glue.Caching

Description

Module supporting the caching of a service.

Synopsis

Documentation

cacheWithBasic Source

Arguments

:: Monad m 
=> (a -> m (Maybe b))

Cache lookup function, used before potentially invoking the fallback service.

-> (a -> b -> m ())

Cache write function, used after invoking the fallback service to populate the cache.

-> BasicService m a b

The service to cache.

-> BasicService m a b 

Caching of a BasicService instance, that defers to external functions for the actual caching. | Note: Values within m will be lost for calls that hit the cache.

cacheWithMulti Source

Arguments

:: (Monad m, Functor m, Eq a, Hashable a) 
=> (MultiGetRequest a -> m (MultiGetResponse a b))

Cache lookup function, used before potentially invoking the fallback service.

-> (MultiGetResponse a b -> m ())

Cache write function, used after invoking the fallback service to populate the cache.

-> MultiGetService m a b

The service to cache.

-> MultiGetService m a b 

Caching of a MultiGetService instance, that defers to external functions for the actual caching. | Partial responses will result in partial fallback calls that get just the missing keys. | Values within m will be lost for calls that hit the cache.