cache.go
func NewFrom(defaultExpiration, cleanupInterval time.Duration, items map[string]Item) *Cache {
	return newCacheWithJanitor(defaultExpiration, cleanupInterval, items)
}
func NewFrom(defaultExpiration, cleanupInterval time.Duration, items map[string]Item) *Cache {
	return newCacheWithJanitor(defaultExpiration, cleanupInterval, items)
}
func NewFrom ( defaultExpiration , cleanupInterval time . Duration , items map [ string ] Item ) * Cache { return newCacheWithJanitor ( defaultExpiration , cleanupInterval , items ) }
// Return a new cache with a given default expiration duration and cleanup
// interval. If the expiration duration is less than one (or NoExpiration),
// the items in the cache never expire (by default), and must be deleted
// manually. If the cleanup interval is less than one, expired items are not
// deleted from the cache before calling c.DeleteExpired().
//
// NewFrom() also accepts an items map which will serve as the underlying map
// for the cache. This is useful for starting from a deserialized cache
// (serialized using e.g. gob.Encode() on c.Items()), or passing in e.g.
// make(map[string]Item, 500) to improve startup performance when the cache
// is expected to reach a certain minimum size.
//
// Only the cache's methods synchronize access to this map, so it is not
// recommended to keep any references to the map around after creating a cache.
// If need be, the map can be accessed at a later point using c.Items() (subject
// to the same caveat.)
//
// Note regarding serialization: When using e.g. gob, make sure to
// gob.Register() the individual types stored in the cache before encoding a
// map retrieved with c.Items(), and to register those same types before
// decoding a blob containing an items map.
Return a new cache with a given default expiration duration and cleanup interval . If the expiration duration is less than one ( or NoExpiration ) the items in the cache never expire ( by default ) and must be deleted manually . If the cleanup interval is less than one expired items are not deleted from the cache before calling c . DeleteExpired () . NewFrom () also accepts an items map which will serve as the underlying map for the cache . This is useful for starting from a deserialized cache ( serialized using e . g . gob . Encode () on c . Items () ) or passing in e . g . make ( map [ string ] Item 500 ) to improve startup performance when the cache is expected to reach a certain minimum size . Only the cache s methods synchronize access to this map so it is not recommended to keep any references to the map around after creating a cache . If need be the map can be accessed at a later point using c . Items () ( subject to the same caveat . ) Note regarding serialization : When using e . g . gob make sure to gob . Register () the individual types stored in the cache before encoding a map retrieved with c . Items () and to register those same types before decoding a blob containing an items map .