func (q *Type) Add(item interface{}) (accepted bool) {
	q.cond.L.Lock()
	defer q.cond.L.Unlock()
	if q.shuttingDown {
		return false
	}
	key := getKey(item)
	if _, ok := q.dirty[key]; ok {
		if q.Replace {
			q.dirty[key] = item
		}
		return true
	}
	if len(q.queue) >= q.MaxSize {
		return false
	}
	q.dirty[key] = item
	if _, ok := q.processing[key]; ok {
		return true
	}
	q.queue = append(q.queue, key)
	q.cond.Signal()
	return true
}
Add marks item as needing processing.
package workqueue
import (
	"sync"
)
const (
	DefaultMaxSize = 10000
)
type Interface interface {
	Add(item interface{}) (accepted bool)
	Len() int
	Get() (item interface{}, shutdown bool)
	Done(item interface{})
	ShutDown()
	ShuttingDown() bool
}
func NewNamed(maxSize int, _ string) *Type {
	return NewWorkQueue(maxSize, false)
}
func NewWorkQueue(maxSize int, replace bool) *Type {
	return &Type{
		MaxSize:    maxSize,
		Replace:    replace,
		dirty:      make(map[interface{}]interface{}),
		processing: make(map[interface{}]interface{}),
		cond:       sync.NewCond(&sync.Mutex{}),
	}
}
func New() *Type {
	return NewWorkQueue(DefaultMaxSize, false)
}
type Type struct {
	MaxSize int
	Replace bool
	queue []interface{}
	dirty map[interface{}]interface{}
	processing map[interface{}]interface{}
	cond *sync.Cond
	shuttingDown bool
}