Documentation ¶
Index ¶
- func Init()
- func SetRedisPoolConfig(c *PoolTimeConfig)
- type IdempotenceStorage
- type PoolTimeConfig
- type RedisStorage
- func (idempotence *RedisStorage) CheckAndSetStatus(id string, status []string, newStatus string, t int) bool
- func (idempotence *RedisStorage) CheckStatus(id string, status []string) bool
- func (idempotence *RedisStorage) Delete(idempotenceID id.IdempotenceID) bool
- func (idempotence *RedisStorage) SaveIfAbsent(idempotenceID id.IdempotenceID) bool
- func (idempotence *RedisStorage) SaveStatusIfAbsent(id, status string, t time.Duration) bool
- type Storage
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SetRedisPoolConfig ¶
func SetRedisPoolConfig(c *PoolTimeConfig)
SetRedisPoolConfig 设置redis连接池的配置
Types ¶
type IdempotenceStorage ¶
type IdempotenceStorage int8
IdempotenceStorage IdempotenceStorage
const ( // Mongo Mongo Mongo IdempotenceStorage = iota // Redis Redis Redis )
type PoolTimeConfig ¶
type PoolTimeConfig struct { // 连接池中拥有的最小连接数 InitialCap int // 最大并发存活连接数 MaxCap int // 最大空闲连接 MaxIdle int // 连接最大空闲时间,超过该事件则将失效 IdleTimeout time.Duration }
PoolTimeConfig 连接池时间配置
type RedisStorage ¶
type RedisStorage struct { }
RedisStorage RedisStorage
func (*RedisStorage) CheckAndSetStatus ¶
func (idempotence *RedisStorage) CheckAndSetStatus(id string, status []string, newStatus string, t int) bool
CheckAndSetStatus 检测并且设置
func (*RedisStorage) CheckStatus ¶
func (idempotence *RedisStorage) CheckStatus(id string, status []string) bool
CheckStatus 检测状态
func (*RedisStorage) Delete ¶
func (idempotence *RedisStorage) Delete(idempotenceID id.IdempotenceID) bool
Delete 删除
func (*RedisStorage) SaveIfAbsent ¶
func (idempotence *RedisStorage) SaveIfAbsent(idempotenceID id.IdempotenceID) bool
SaveIfAbsent 如果没有则保存
type Storage ¶
type Storage interface { SaveIfAbsent(idempotenceID id.IdempotenceID) bool Delete(idempotenceID id.IdempotenceID) bool SaveStatusIfAbsent(id, status string, t time.Duration) bool CheckStatus(id string, status []string) bool CheckAndSetStatus(id string, status []string, newStatus string, t int) bool }
Storage 存储接口
Click to show internal directories.
Click to hide internal directories.