// New returns a new TTL instance.
// Optional callback function cb is called when an item times out.
New returns a new TTL instance.
Optional callback function cb is called when an item times out.
// New returns a new TTL instance . // Optional callback function cb is called when an item times out .
func New(cb OnItemTimeout) *TTL {
	p := &TTL{
		ids:       make(map[ItemID]*Item),
		cb:        cb,
		timer:     time.NewTimer(0),
		mu:        sync.Mutex{},
		resetchan: make(chan struct{}),
	}
	return p
}
func New ( cb OnItemTimeout ) * TTL { p := & TTL { ids : make ( map [ ItemID ] * Item ) , cb : cb , timer : time . NewTimer ( 0 ) , mu : sync . Mutex { } , resetchan : make ( chan struct { } ) , } return p }
New returns a new TTL instance.
New returns a new TTL instance .