Documentation ¶
Overview ¶
Package sozu contains implementation details for the sozu strategy.
The sozu strategy attempts to execute the batch function everytime the keys array hits capacity. Then subsequent calls to Load(), after the batch function has been called once, start a new worker which will call the batch function once again after the keys array capacity has been hit. It's goal is to ensure that they batch function is called with the most number of keys possible.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewSozuStrategy ¶
func NewSozuStrategy(opts ...Option) dataloader.StrategyFunction
NewSozuStrategy returns a new instance of the Sozu strategy. The Sozu strategy calls the batch function everytime the keys array hits capacity. The Sozu Strategy also implements a timer that triggers the batch load function after a specified timeout duration (see Options) to ensure it doesn't block for too long. It attempts to ensure that each call to the batch function includes an array of keys whose length is >= 1 and <= the capacity.
Types ¶
type Option ¶ added in v0.4.0
type Option func(*options)
Option accepts the dataloader and sets an option on it.
func WithLogger ¶ added in v0.5.0
WithLogger adds a logger to the strategy. Default is a no op logger.
func WithTimeout ¶ added in v0.4.0
WithTimeout sets the timeout value for the strategy