func (store *Internal) expire() {
	log.WithFields(log.Fields{"type": "store", "store": "internal"}).Infof("running garbage collector")
	count := 0
	for k, v := range store.entries {
		store.mu.Lock()
		if v.expired() {
			delete(store.entries, k)
			count++
		}
		store.mu.Unlock()
	}
	log.WithFields(log.Fields{"type": "store", "store": "internal"}).Infof("garbage collector deleted %d entries", count)
}
expire deletes entries that have expired
package store
import (
	"fmt"
	"sync"
	"time"
	log "github.com/sirupsen/logrus"
)
type entry struct {
	value     string
	expiresOn time.Time
	noexpire  bool
}
func (e entry) expired() bool {
	if e.noexpire {
		return false
	}
	if time.Now().After(e.expiresOn) {
		return true
	}
	return false
}
type Internal struct {
	*Store
	entries    map[string]*entry
	ticker     *time.Ticker
	gcInterval time.Duration
	mu         *sync.RWMutex
}
func NewInternalStore() (*Internal, error) {
	return &Internal{
		Store: &Store{
			driver:     "internal",
			parameters: "",
		},
		entries:    make(map[string]*entry),
		ticker:     time.NewTicker(time.Second),
		gcInterval: 60 * time.Second,
		mu:         &sync.RWMutex{},
	}, nil
}
func (store *Internal) start() {
	go func() {
		for range store.ticker.C {
			store.expire()
		}
	}()
}