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

Glue.Caching

Description

Module supporting the caching of a service.

Synopsis

# Documentation

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.

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.