func New(expiryInterval time.Duration) *Cache {
	entries := make(map[string]entry)
	c := &Cache{entries: entries, now: time.Now}
	go func() {
		for {
			time.Sleep(expiryInterval)
			c.evictExpired()
		}
	}()
	return c
}
New creates a new cache which evicts expired entries every expiryInterval.
package cache
import (
	"sync"
	"time"
)
type Cache struct {
	entries map[string]entry
	now     func() time.Time
	mu      sync.RWMutex
}
type entry struct {
	value  interface{}
	expiry time.Time
}
func (e *entry) isExpired(now time.Time) bool { return now.After(e.expiry) }