| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Glue.Caching
Description
Module supporting the caching of a service.
- cacheWithBasic :: Monad m => (a -> m (Maybe b)) -> (a -> b -> m ()) -> BasicService m a b -> BasicService m a b
- cacheWithMulti :: (Monad m, Functor m, Eq a, Hashable a) => (MultiGetRequest a -> m (MultiGetResponse a b)) -> (MultiGetResponse a b -> m ()) -> MultiGetService m a b -> MultiGetService m a b
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.