func (c *cache) Set(k string, x interface{}, d time.Duration) {
	c.Lock()
	c.set(k, x, d)
	c.Unlock()
}
Add an item to the cache, replacing any existing item. If the duration is 0
(DefaultExpiration), the cache's default expiration time is used. If it is -1
(NoExpiration), the item never expires.
package cache
import (
	"encoding/gob"
	"fmt"
	"io"
	"os"
	"runtime"
	"sync"
	"time"
)
type Item struct {
	Object     interface{}
	Expiration *time.Time
}
func (item *Item) Expired() bool {
	if item.Expiration == nil {
		return false
	}
	return item.Expiration.Before(time.Now())
}
const (
	NoExpiration time.Duration = -1
	DefaultExpiration time.Duration = 0
)
type Cache struct {
	*cache
}
type cache struct {
	sync.RWMutex
	defaultExpiration time.Duration
	items             map[string]*Item
	janitor           *janitor
}