// New creates a new cache.
171594
func New(options ...Option) (Cache, error) {
	c := &cache{
		id:       identifier.NewUUID().String(),
		interval: time.Minute,
		ttl:      10 * time.Minute,
		buckets:  make(map[string]*bucket),
		taskc:    make(chan task),
		lenc:     make(chan chan int),
	}
	for _, option := range options {
		if err := option(c); err != nil {
			return nil, errors.Annotate(err, ErrSettingOptions, errorMessages)
		}
	}
	if c.load == nil {
		return nil, errors.New(ErrNoLoader, errorMessages)
	}
	c.backend = loop.Go(c.backendLoop, "cache", c.id)
	return c, nil
}
796920
func New(threads int, s Storage) (*Queue, error) {
	if s == nil {
		s = &InMemoryQueueStorage{MaxSize: 100000}
	}
	if err := s.Init(); err != nil {
		return nil, err
	}
	return &Queue{
		Threads:     threads,
		storage:     s,
		lock:        &sync.Mutex{},
		threadChans: make([]chan bool, 0, threads),
	}, nil
}
1113225
func New(size int) *Cache {
	ssize := size / shardSize
	if ssize < 512 {
		ssize = 512
	}

	c := &Cache{}

	// Initialize all the shards
	for i := 0; i < shardSize; i++ {
		c.shards[i] = newShard(ssize)
	}
	return c
}
1224226
func New(config fab.EndpointConfig, opts ...options.Opt) (*ChannelProvider, error) {
	return &ChannelProvider{
		ctxtCaches: lazycache.New(
			"Client_Context_Cache",
			func(key lazycache.Key) (interface{}, error) {
				ck := key.(*ctxtCacheKey)
				return newContextCache(ck.context, opts), nil
			},
		),
	}, nil
}
363648
func New(params *stripe.TaxRateParams) (*stripe.TaxRate, error) {
	return getC().New(params)
}
172227
func New() Definition {
	var q Definition
	q.Where = make(map[string]interface{})
	q.Sort = make(map[string]interface{})
	return q
}
710980
func newCache(capacity int) *cache {
	if capacity <= 0 {
		capacity = MinCacheCapacity
	}
	return &cache{
		capacity: capacity,
		entries:  make(map[string]entry),
	}
}
1224136
func NewCache(maxSize uint64) *Cache {
	return &Cache{
		maxSize:      maxSize,
		store:        newRing(),
		lastSnapshot: time.Now(),
		tracker:      newCacheTracker(newCacheMetrics(nil), nil),
	}
}
94592
func (a Algorithm) New() Digester {
	return &digester{
		alg:  a,
		hash: a.Hash(),
	}
}
1251644
func NewCache(fs afero.Fs, maxAge time.Duration) *Cache {
	return &Cache{
		Fs:      fs,
		nlocker: &lockTracker{Locker: locker.NewLocker(), seen: make(map[string]struct{})},
		maxAge:  maxAge,
	}
}
1100111
func New() *Driver {
	return &Driver{
		baseEmbed: baseEmbed{
			Base: base.Base{
				StorageDriver: &driver{
					root: &dir{
						common: common{
							p:   "/",
							mod: time.Now(),
						},
					},
				},
			},
		},
	}
}
896483
func New(client client.APIClient, noResolve bool) *IDResolver {
	return &IDResolver{
		client:    client,
		noResolve: noResolve,
		cache:     make(map[string]string),
	}
}
316794
func New(deps *deps.Deps) *Namespace {

	return &Namespace{
		deps:         deps,
		cacheGetCSV:  deps.FileCaches.GetCSVCache(),
		cacheGetJSON: deps.FileCaches.GetJSONCache(),
		client:       http.DefaultClient,
	}
}
1335745
func NewCache(maxEntries int, ttl time.Duration, staticTTL bool,
	onEvicted func(itmID string, value interface{})) (c *Cache) {
	c = &Cache{
		cache:      make(map[string]*cachedItem),
		groups:     make(map[string]map[string]struct{}),
		onEvicted:  onEvicted,
		maxEntries: maxEntries,
		ttl:        ttl,
		staticTTL:  staticTTL,
		lruIdx:     list.New(),
		lruRefs:    make(map[string]*list.Element),
		ttlIdx:     list.New(),
		ttlRefs:    make(map[string]*list.Element),
	}
	if c.ttl > 0 {
		go c.cleanExpired()
	}
	return
}
213527
func NewCache(backend Reader) *Cache {
	return &Cache{
		backend: backend,
		names:   make(map[string]*nameInfo),
	}
}
669650
func New(c *tlc.Container, source wsync.Pool, cache wsync.WritablePool) *CachePool {
	cp := &CachePool{
		container: c,
		source:    source,
		cache:     cache,
		fileChans: make([]chan struct{}, len(c.Files)),
	}

	for i := range cp.fileChans {
		cp.fileChans[i] = make(chan struct{})
	}

	return cp
}
1217051
func New(maxBytes int64, cache, origin blobserver.Storage) *Storage {
	sto := &Storage{
		origin:        origin,
		cache:         cache,
		lru:           lru.NewUnlocked(0),
		maxCacheBytes: maxBytes,
	}
	return sto
}