Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Pool ¶
type Pool struct {
New func() interface{}
// contains filtered or unexported fields
}
Pool is a drop-in replacement for sync.Pool Its difference is that evicts older elements so memory can be freed
func (*Pool) Get ¶
func (p *Pool) Get() (x interface{})
Get selects the most recent used item from the Pool, removes it from the Pool, and returns it to the caller. Get may choose to ignore the pool and treat it as empty. Callers should not assume any relation between values passed to Put and the values returned by Get.
If Get would otherwise return nil and p.New is non-nil, Get returns the result of calling p.New.
type SlicedStack ¶
SlicedStack implements a simple stack on a slice
func (*SlicedStack) Len ¶
func (s *SlicedStack) Len() int
Len returns the number of elements in the array
func (*SlicedStack) Pop ¶
func (s *SlicedStack) Pop() interface{}
Pop gets the last element inserted
func (*SlicedStack) Push ¶
func (s *SlicedStack) Push(x interface{})
Put pushes en element into the stack