func (c *Cache) EvictRandom() {
	clen := len(c.m)
	if clen < c.capacity {
		return
	}
	i := c.capacity - clen
	for k, _ := range c.m {
		delete(c.m, k)
		i--
		if i == 0 {
			break
		}
	}
}
EvictRandom removes a random member a the cache.
Must be called under a write lock.
package cache
import (
	"crypto/sha1"
	"sync"
	"time"
	"github.com/miekg/dns"
)
type elem struct {
	expiration time.Time  
	msg        *dns.Msg
}
type Cache struct {
	sync.RWMutex
	capacity int
	m        map[string]*elem
	ttl      time.Duration
}
func New(capacity, ttl int) *Cache {
	c := new(Cache)
	c.m = make(map[string]*elem)
	c.capacity = capacity
	c.ttl = time.Duration(ttl) * time.Second
	return c
}
func (c *Cache) Capacity() int { return c.capacity }
func (c *Cache) Remove(s string) {
	c.Lock()
	delete(c.m, s)
	c.Unlock()
}