()
| 30 | } |
| 31 | |
| 32 | func NewIPList() *IPList { |
| 33 | var list = &IPList{ |
| 34 | itemsMap: map[uint64]*IPItem{}, |
| 35 | bufferItemsMap: map[uint64]*IPItem{}, |
| 36 | allItemsMap: map[uint64]*IPItem{}, |
| 37 | ipMap: map[string]*IPItem{}, |
| 38 | } |
| 39 | |
| 40 | var expireList = expires.NewList() |
| 41 | expireList.OnGC(func(itemId uint64) { |
| 42 | list.Delete(itemId) |
| 43 | }) |
| 44 | list.expireList = expireList |
| 45 | return list |
| 46 | } |
| 47 | |
| 48 | func (this *IPList) Add(item *IPItem) { |
| 49 | if this.isDeleted { |