Documentation ¶
Index ¶
- type Callback
- type IPool
- type Pool
- func (p *Pool) Cap() int
- func (p *Pool) Clear()
- func (p *Pool) ForEach(cb Callback)
- func (p *Pool) Get(key interface{}) interface{}
- func (p *Pool) GetOrPut(key, value interface{}) (interface{}, bool, *gerr.GatewayDError)
- func (p *Pool) Pool() *sync.Map
- func (p *Pool) Pop(key interface{}) interface{}
- func (p *Pool) Put(key, value interface{}) *gerr.GatewayDError
- func (p *Pool) Remove(key interface{})
- func (p *Pool) Size() int
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type IPool ¶ added in v0.2.2
type IPool interface { ForEach(cb Callback) Pool() *sync.Map Put(key, value interface{}) *gerr.GatewayDError Get(key interface{}) interface{} GetOrPut(key, value interface{}) (interface{}, bool, *gerr.GatewayDError) Pop(key interface{}) interface{} Remove(key interface{}) Size() int Clear() Cap() int }
type Pool ¶
type Pool struct {
// contains filtered or unexported fields
}
func (*Pool) ForEach ¶
ForEach iterates over the pool and calls the callback function for each key/value pair.
func (*Pool) Get ¶
func (p *Pool) Get(key interface{}) interface{}
Get returns the value for the given key.
func (*Pool) GetOrPut ¶
func (p *Pool) GetOrPut(key, value interface{}) (interface{}, bool, *gerr.GatewayDError)
GetOrPut returns the value for the given key if it exists, otherwise it adds the key/value pair to the pool.
func (*Pool) Pop ¶
func (p *Pool) Pop(key interface{}) interface{}
Pop removes the key/value pair from the pool and returns the value.
func (*Pool) Put ¶
func (p *Pool) Put(key, value interface{}) *gerr.GatewayDError
Put adds a new key/value pair to the pool.
Click to show internal directories.
Click to hide internal directories.