func (rc *Ramcache) Set(key string, obj interface{}) error {
	rc.Lock()
	defer rc.Unlock()
	i := newItem(key, obj)
	existing, ok := rc.cache[key]
	if ok {
		heap.Remove(&rc.tqueue, existing.index)
		i.createdAt = existing.createdAt
	}
	rc.cache[key] = i
	rc.tqueue.Insert(i)
	return nil
}
Set inserts a value in the cache.  If an object already exists,
it will be replaced, but the createdAt timestamp won't change.
package ramcache  
import (
	"container/heap"
	"errors"
	"fmt"
	"sync"
	"time"
)
var ErrNotFound = errors.New("ramcache: key not found in cache")
type Ramcache struct {
	cache  map[string]*item
	tqueue timeQueue
	TTL    time.Duration
	MaxAge time.Duration
	frozen bool
	done   chan bool
	sync.RWMutex
}
func New() *Ramcache {
	tq := make(timeQueue, 0)
	c := make(map[string]*item)
	d := make(chan bool)
	r := &Ramcache{cache: c, tqueue: tq, TTL: 5 * time.Minute, done: d}
	go r.cleanup()
	return r
}
func (rc *Ramcache) Get(key string) (interface{}, error) {
	rc.Lock()
	defer rc.Unlock()
	i, ok := rc.cache[key]
	if !ok {
		return nil, ErrNotFound
	}
	if rc.MaxAge > 0 && time.Since(i.createdAt) > rc.MaxAge {
		heap.Remove(&rc.tqueue, i.index)
		delete(rc.cache, key)
		return nil, ErrNotFound
	}
	rc.tqueue.Access(i)
	return i.value, nil
}
func (rc *Ramcache) GetNoAccess(key string) (interface{}, error) {
	rc.Lock()
	defer rc.Unlock()
	i, ok := rc.cache[key]
	if !ok {
		return nil, ErrNotFound
	}
	if rc.MaxAge > 0 && time.Since(i.createdAt) > rc.MaxAge {
		heap.Remove(&rc.tqueue, i.index)
		delete(rc.cache, key)
		return nil, ErrNotFound
	}
	return i.value, nil
}