func (this *MemoryStore) Put(item DataItem) (int64, error) {
	this.Lock()
	defer this.Unlock()
	atomic.AddInt64(&this.globalID, 1)
	item.ID = this.globalID
	this.data.PushBack(item)
	return item.ID, nil
}
Put Put item
package validate
import (
	"container/list"
	"errors"
	"sync"
	"sync/atomic"
	"time"
)
func NewMemoryStore(gcInterval time.Duration) Store {
	if gcInterval == 0 {
		gcInterval = DefaultGCInterval
	}
	memStore := &MemoryStore{
		data:       list.New(),
		gcInterval: gcInterval,
	}
	go memStore.gc()
	return memStore
}
type MemoryStore struct {
	sync.RWMutex
	globalID   int64
	gcInterval time.Duration
	data       *list.List
}
func (this *MemoryStore) gc() {
	time.AfterFunc(this.gcInterval, func() {
		defer this.gc()
		for {
			this.RLock()
			ele := this.data.Front()
			if ele == nil {
				this.RUnlock()
				break
			}
			item := ele.Value.(DataItem)
			this.RUnlock()
			if (item.CreateTime.UnixNano() + int64(item.Expire/time.Nanosecond)) < time.Now().UnixNano() {
				this.Lock()
				this.data.Remove(ele)
				this.Unlock()
				continue
			}
			break
		}
	})
}