Documentation ¶
Index ¶
- type SequenceGeneratorExt
- func (d *SequenceGeneratorExt) Application() *gobay.Application
- func (d *SequenceGeneratorExt) Close() error
- func (g *SequenceGeneratorExt) GetSequence() (uint64, error)
- func (g *SequenceGeneratorExt) GetSequences(count, batchSize uint64) *Sequences
- func (d *SequenceGeneratorExt) Init(app *gobay.Application) error
- func (d *SequenceGeneratorExt) Object() interface{}
- type Sequences
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type SequenceGeneratorExt ¶
type SequenceGeneratorExt struct { NS string RedisExtName gobay.Key SequenceBase uint64 SequenceKey string // contains filtered or unexported fields }
func (*SequenceGeneratorExt) Application ¶
func (d *SequenceGeneratorExt) Application() *gobay.Application
Application implements Extension interface
func (*SequenceGeneratorExt) Close ¶
func (d *SequenceGeneratorExt) Close() error
Close implements Extension interface
func (*SequenceGeneratorExt) GetSequence ¶
func (g *SequenceGeneratorExt) GetSequence() (uint64, error)
func (*SequenceGeneratorExt) GetSequences ¶
func (g *SequenceGeneratorExt) GetSequences(count, batchSize uint64) *Sequences
批量生成 sequence, 减少 redis 请求 count: 需要生成的 sequence 数量 batch_size: 单词请求 redis 取得的 sequence 数量, 调用 redis 生成 sequence 的 QPS 不能超过 (MAX_SEQUENCE / batch_size + 1) * 1000 => batch_size = MAX_SEQUENCE / (MAX_QPS / 1000 - 1) 以单台 redis 极限 4w QPS 计算(单条命令 25us), batch_size = 210.0512820513
func (*SequenceGeneratorExt) Init ¶
func (d *SequenceGeneratorExt) Init(app *gobay.Application) error
Init implements Extension interface
func (*SequenceGeneratorExt) Object ¶
func (d *SequenceGeneratorExt) Object() interface{}
Object implements Extension interface
Click to show internal directories.
Click to hide internal directories.