package
0.0.0-20190422025920-beccf3fe4313
Repository: https://github.com/changwh/go-common.git
Documentation: pkg.go.dev

# README

go-common/sync/pipeline/fanout

以前的library/cache包改为pipeline/fanout

增加使用范围 不止由于异步增加缓存 也可以用在其他地方

功能:

  • 支持定义Worker 数量的goroutine,进行消费
  • 内部支持的元数据传递(library/net/metadata)
  • 后续会作废library/cache,以及统一收敛Go并行里面的扇出模型

示例:

//名称为cache 执行线程为1 buffer长度为1024
cache := fanout.New("cache", fanout.Worker(1), fanout.Buffer(1024))
cache.Do(c, func(c context.Context) { SomeFunc(c, args...) })
cache.Close()

# Functions

Buffer specifies the buffer of fanout.
New new a fanout struct.
Worker specifies the worker of fanout.

# Variables

ErrFull chan full.

# Structs

Fanout async consume data from chan.

# Type aliases

Option fanout option.