redis_dao

package
v0.0.0-...-d9af017 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2017 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

TODO(@benqi): 可以使用如下方法来生成seq - 如果运维能保证redis数据可靠性,可移除数据库seq_updates_ngen的存储 - 可使用[seqsvr](https://github.com/nebula-in/seqsvr)服务来生成seq - 可调研艺龙的序列号生成器 - 直接使用etcd或zk

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type SequenceDAO

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

func NewSequenceDAO

func NewSequenceDAO(redis *redis_client.RedisPool) *SequenceDAO

func (*SequenceDAO) Incr

func (dao *SequenceDAO) Incr(key string) (seq int64, err error)

独立出incr和set的原因 在NextID直接获取redis的连接,incr执行完后可能存在操作数据库的大事物 有可能会导致redis在一段时间内未释放 独立出来后,一旦执行incr或set则立即释放redis连接

func (*SequenceDAO) Set

func (dao *SequenceDAO) Set(key string, seq int64) (err error)

Jump to

Keyboard shortcuts

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