seqgenext

package
v0.0.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 24, 2019 License: MIT Imports: 4 Imported by: 0

Documentation

Index

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

Init implements Extension interface

func (*SequenceGeneratorExt) Object

func (d *SequenceGeneratorExt) Object() interface{}

Object implements Extension interface

type Sequences

type Sequences struct {
	// contains filtered or unexported fields
}

func (*Sequences) HasNext

func (s *Sequences) HasNext() bool

func (*Sequences) Next

func (s *Sequences) Next() (uint64, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL