func (c *Cache) RemoveOldest() (key, value interface{}) {
	c.mu.Lock()
	defer c.mu.Unlock()
	return c.removeOldest()
}
RemoveOldest removes the oldest item in the cache and returns its key and value.
If the cache is empty, the empty string and nil are returned.
package node
import (
	"container/list"
	"sync"
)
type Cache struct {
	maxEntries int
	mu    sync.Mutex
	ll    *list.List
	cache map[interface{}]*list.Element
}
type entry struct {
	key, value interface{}
}
func NewCache(maxEntries int) *Cache {
	return &Cache{
		maxEntries: maxEntries,
		ll:         list.New(),
		cache:      make(map[interface{}]*list.Element),
	}
}
func (c *Cache) Add(key, value interface{}) {
	c.mu.Lock()
	defer c.mu.Unlock()
	if ee, ok := c.cache[key]; ok {
		c.ll.MoveToFront(ee)
		ee.Value.(*entry).value = value
		return
	}
	ele := c.ll.PushFront(&entry{key, value})
	c.cache[key] = ele
	if c.ll.Len() > c.maxEntries {
		c.removeOldest()
	}
}
func (c *Cache) Get(key interface{}) (value interface{}, ok bool) {
	c.mu.Lock()
	defer c.mu.Unlock()
	if ele, hit := c.cache[key]; hit {
		c.ll.MoveToFront(ele)
		return ele.Value.(*entry).value, true
	}
	return
}