// NewProjectCache returns a non-initialized ProjectCache. The cache needs to be run to begin functioning
16798
func NewProjectCache(namespaces cache.SharedIndexInformer, client corev1client.NamespaceInterface, defaultNodeSelector string) *ProjectCache {
	if err := namespaces.GetIndexer().AddIndexers(cache.Indexers{
		"requester": indexNamespaceByRequester,
	}); err != nil {
		panic(err)
	}
	return &ProjectCache{
		Client:              client,
		Store:               namespaces.GetIndexer(),
		HasSynced:           namespaces.GetController().HasSynced,
		DefaultNodeSelector: defaultNodeSelector,
	}
}
574439
func NewNonceCache(capacity int, cacheTTL int, timeProvider timetools.TimeProvider) (*NonceCache, error) {
	c, err := ttlmap.NewMapWithProvider(capacity, timeProvider)
	if err != nil {
		return nil, err
	}

	return &NonceCache{
		cache:        c,
		cacheTTL:     cacheTTL,
		timeProvider: timeProvider,
	}, nil
}
1224304
func NewCache(size int64) *Storage {
	return &Storage{
		maxSize: size,
		lru:     lru.New(0), // infinite items; we evict by size, not count
	}
}
8053
func (c *Client) setCachedProjectID(label string, id *manifold.ID) {
	c.Lock()
	defer c.Unlock()

	c.projectIDs[label] = id
}
1233662
func NewProjectFromEnv() (*Project, error) {
	cli, err := client.NewEnvClient()
	if err != nil {
		return nil, err
	}
	ping := types.Ping{APIVersion: CurrentAPIVersion}
	cli.NegotiateAPIVersionPing(ping)
	return NewProject(cli), nil
}
765609
func NewCache(c Coser) Coser {
	return &cache{
		Coser:     c,
		cache:     make(map[string]float32),
		errCache:  make(map[string]error),
		cosnCache: make(map[string][]Match),
	}
}
1294740
func (sc *serviceRegistryCache) BuildCache(publicPorts map[zkr.PublicPortKey]zkr.PublicPort, vhosts map[zkr.VHostKey]zkr.VHost) {
	sc.registry = make(map[string]*serviceRegistry, 0)
	for key, value := range publicPorts {
		serviceRegistry := sc.GetRegistryForService(value.ServiceID)
		serviceRegistry.PublicPorts[key] = value
	}
	for key, value := range vhosts {
		serviceRegistry := sc.GetRegistryForService(value.ServiceID)
		serviceRegistry.VHosts[key] = value
	}
	return
}
1094532
func New(*Options) *Cache {
	// Initialize the heap. The buffer of 1 is really important because
	// its possible for the expiry loop to trigger the heap to update
	// itself and it'd block forever otherwise.
	h := &expiryHeap{NotifyCh: make(chan struct{}, 1)}
	heap.Init(h)

	c := &Cache{
		types:             make(map[string]typeEntry),
		entries:           make(map[string]cacheEntry),
		entriesExpiryHeap: h,
		stopCh:            make(chan struct{}),
	}

	// Start the expiry watcher
	go c.runExpiryLoop()

	return c
}
309970
func NewProjectionInProcess(ctx *plan.Context, p *plan.Projection) *Projection {
	s := &Projection{
		TaskBase: NewTaskBase(ctx),
		p:        p,
	}
	s.Handler = s.projectionEvaluator(p.Final)
	return s
}
1082263
func NewAppProjectInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer {
	return NewFilteredAppProjectInformer(client, namespace, resyncPeriod, indexers, nil)
}
397338
func New(config Config) *Cache {
	return &Cache{
		m:      make(map[Key]*list.Element, config.MaxItems),
		l:      list.New(),
		config: config,
	}
}
916948
func ProjectBuild(p project.APIProject, c *cli.Context) error {
	config := options.Build{
		NoCache:     c.Bool("no-cache"),
		ForceRemove: c.Bool("force-rm"),
		Pull:        c.Bool("pull"),
	}
	err := p.Build(context.Background(), config, c.Args()...)
	if err != nil {
		return cli.NewExitError(err.Error(), 1)
	}
	return nil
}
751327
func (s *ProjectService) CreateProject(p *CreateProjectParams) (*CreateProjectResponse, error) {
	resp, err := s.cs.newRequest("createProject", p.toURLValues())
	if err != nil {
		return nil, err
	}

	var r CreateProjectResponse
	if err := json.Unmarshal(resp, &r); err != nil {
		return nil, err
	}

	// If we have a async client, we need to wait for the async result
	if s.cs.async {
		b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout)
		if err != nil {
			if err == AsyncTimeoutErr {
				return &r, err
			}
			return nil, err
		}

		b, err = getRawValue(b)
		if err != nil {
			return nil, err
		}

		if err := json.Unmarshal(b, &r); err != nil {
			return nil, err
		}
	}

	return &r, nil
}
1370175
func NewRegionCache(pdClient pd.Client) *RegionCache {
	c := &RegionCache{
		pdClient: pdClient,
	}
	c.mu.regions = make(map[RegionVerID]*CachedRegion)
	c.mu.sorted = btree.New(btreeDegree)
	c.storeMu.stores = make(map[uint64]*Store)
	return c
}
1031626
func (c *Client) CreateProject(p *CreateProjectParameter) (*Project, error) {
	obj, err := c.Request("createProject", convertParamToMap(p))
	if err != nil {
		return nil, err
	}
	return obj.(*Project), err
}
717113
func NewRefCache(opts ...options.Opt) *lazycache.Cache {
	initializer := func(key lazycache.Key) (interface{}, error) {
		ck, ok := key.(CacheKey)
		if !ok {
			return nil, errors.New("unexpected cache key")
		}
		return NewRef(ck.Context(), ck.Provider(), ck.ChannelID(), opts...), nil
	}

	return lazycache.New("Channel_Cfg_Cache", initializer)
}
605402
func AddProject(project Project) error {
	o := orm.NewOrm()

	_, err := o.Insert(&project)

	return err
}