Safe Haskell | Safe |
---|---|
Language | Haskell2010 |
Module containing a form of caching where values for given keys are preloaded ahead of time. | Once warmed up requests for preloaded keys will be instant, with the values refreshed in the background.
- data PreloadedOptions m a b
- defaultPreloadedOptions :: HashSet a -> MToIO m -> PreloadedOptions m a b
- preloadingService :: forall m n a b. (MonadIO m, MonadIO n, MonadBaseControl IO m, MonadBaseControl IO n, Eq a, Hashable a, Show a) => PreloadedOptions m a b -> MultiGetService m a b -> n (MultiGetService m a b, () -> n ())
- preloadingCall :: forall m n b. (MonadIO m, MonadIO n, MonadBaseControl IO m, MonadBaseControl IO n) => MToIO m -> Int -> m b -> n (m b, () -> n ())
- preloadedKeys :: PreloadedOptions m a b -> HashSet a
- preloadingRefreshTimeMs :: PreloadedOptions m a b -> Int
- preloadingRun :: PreloadedOptions m a b -> MToIO m
Documentation
data PreloadedOptions m a b Source #
Options for determining behaviour of preloading services.
defaultPreloadedOptions :: HashSet a -> MToIO m -> PreloadedOptions m a b Source #
Defaulted options for preloading a HashSet of keys with a 30 second refresh time.
:: (MonadIO m, MonadIO n, MonadBaseControl IO m, MonadBaseControl IO n, Eq a, Hashable a, Show a) | |
=> PreloadedOptions m a b | Instance of |
-> MultiGetService m a b | The service to perform preloading of. |
-> n (MultiGetService m a b, () -> n ()) |
Preloads the results of calls for given keys.
:: (MonadIO m, MonadIO n, MonadBaseControl IO m, MonadBaseControl IO n) | |
=> MToIO m | Get an IO of the call for the caching. |
-> Int | Amount of time between refreshes. |
-> m b | The call to perform preloading of. |
-> n (m b, () -> n ()) |
Preloads a single parameter-less call.
preloadedKeys :: PreloadedOptions m a b -> HashSet a Source #
Keys to preload.
preloadingRefreshTimeMs :: PreloadedOptions m a b -> Int Source #
Amount of time between refreshes.
preloadingRun :: PreloadedOptions m a b -> MToIO m Source #
Get an IO of the response for the caching.