Documentation
¶
Index ¶
- type Batch
- func NewBatch[I comparable, O any](bufferSize int, do func([]I) (map[I]O, error)) Batch[I, O]
- func NewBatchWithTimer[I comparable, O any](bufferSize int, do func([]I) (map[I]O, error), ttl time.Duration) Batch[I, O]
- func NewShardedBatch[I comparable, O any](shards int, hasher hasher.Hasher[I], bufferSize int, ...) Batch[I, O]
- func NewShardedBatchWithTimer[I comparable, O any](shards int, hasher hasher.Hasher[I], bufferSize int, ...) Batch[I, O]
- type BatchConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Batch ¶
type Batch[I comparable, O any] interface { Do(input I) (output O, err error) Flush() Stop() }
func NewBatch ¶
func NewBatch[I comparable, O any](bufferSize int, do func([]I) (map[I]O, error)) Batch[I, O]
NewBatch creates a new Batch instance with fixed size and no timer.
func NewBatchWithTimer ¶
func NewShardedBatch ¶
type BatchConfig ¶
type BatchConfig[I comparable, O any] struct { // contains filtered or unexported fields }
func NewBatchConfig ¶
func NewBatchConfig[I comparable, O any](bufferSize int, do func([]I) (map[I]O, error)) BatchConfig[I, O]
BatchConfig is a builder for Batch.
func (BatchConfig[I, O]) Build ¶
func (cfg BatchConfig[I, O]) Build() Batch[I, O]
Build creates a new Batch instance.
func (BatchConfig[I, O]) WithSharding ¶
func (cfg BatchConfig[I, O]) WithSharding(nbr int, fn hasher.Hasher[I]) BatchConfig[I, O]
WithSharding enables cache sharding.
func (BatchConfig[I, O]) WithTimer ¶
func (cfg BatchConfig[I, O]) WithTimer(ttl time.Duration) BatchConfig[I, O]
WithTimer sets the max time for a batch buffer
Click to show internal directories.
Click to hide internal directories.