Documentation ¶
Index ¶
- type Pool
- type RedisPool
- func (rp *RedisPool) Acquire() (*redis.Z, error)
- func (rp *RedisPool) AcquireString() (ResourceID, string, error)
- func (rp *RedisPool) Clear()
- func (rp *RedisPool) RefreshConfig(newConf config.ServicePoolConfig) error
- func (rp *RedisPool) Release(rz *redis.Z) error
- func (rp *RedisPool) ReleaseString(id string) error
- type ResourceID
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Pool ¶
type Pool interface { // AcquireString 从资源池中获取一个资源 AcquireString() (ResourceID, string, error) // ReleaseString 释放一个资源到资源池 ReleaseString(ResourceID) error // Clear 清空资源池 Clear() // RefreshConfigs 刷新配置 RefreshConfig(config.ServicePoolConfig) error }
Pool 资源池接口
type RedisPool ¶
type RedisPool struct {
// contains filtered or unexported fields
}
RedisPool 实现 Pool 接口
func NewRedisPool ¶
func NewRedisPool(ctx context.Context, cli *redis.Client, rdsKey string, conf config.ServicePoolConfig) *RedisPool
NewRedisPool 创建一个新的 服务池 每次新建一个服务池时,会清空原有服务池
func (*RedisPool) AcquireString ¶ added in v0.2.4
func (rp *RedisPool) AcquireString() (ResourceID, string, error)
AcquireString 从资源池中获取一个资源, 返回值为string
func (*RedisPool) RefreshConfig ¶ added in v0.4.14
func (rp *RedisPool) RefreshConfig(newConf config.ServicePoolConfig) error
RefreshConfig 刷新配置
func (*RedisPool) ReleaseString ¶ added in v0.2.4
ReleaseString 释放一个资源到资源池, v为string
Click to show internal directories.
Click to hide internal directories.