// buildServiceRegistryCache builds the cache of public endpoints based on data in zookeeper
972651
func (zk *zkf) buildServiceRegistryCache(conn client.Connection) error {
	publicPorts, err := zkr.GetPublicPorts(conn)
	if err != nil {
		return err
	}
	vhosts, err := zkr.GetVHosts(conn)
	if err != nil {
		return err
	}
	zk.svcRegistry.BuildCache(publicPorts, vhosts)
	return nil
}
759408
func newCache() *cache {
	c := cache{
		m:       make(map[reflect.Type]*structInfo),
		regconv: make(map[reflect.Type]Converter),
		tag:     "schema",
	}
	return &c
}
817876
func (c *Context) ServiceCache(key string, res interface{}) (exists bool) {
	return c.getCacheVal("service", key, res)
}
318458
func (env *azureEnviron) StorageProviderTypes() ([]storage.ProviderType, error) {
	return []storage.ProviderType{azureStorageProviderType}, nil
}
648672
func (t *cachedTokenSource) baseCache() map[string]string {
	t.lk.Lock()
	defer t.lk.Unlock()
	ret := map[string]string{}
	for k, v := range t.cache {
		ret[k] = v
	}
	delete(ret, "access-token")
	delete(ret, "expiry")
	return ret
}
528972
func (f *Facade) GetServicesByPool(ctx datastore.Context, poolID string) ([]service.Service, error) {
	defer ctx.Metrics().Stop(ctx.Metrics().Start("Facade.GetServicesByPool"))
	glog.V(3).Infof("Facade.GetServicesByPool")
	store := f.serviceStore
	results, err := store.GetServicesByPool(ctx, poolID)
	if err != nil {
		glog.Error("Facade.GetServicesByPool: err=", err)
		return results, err
	}

	// For performance optimizations, do not retrieve config files, but we do need to fill out
	//    the address assignments.
	for i, _ := range results {
		if err = f.fillServiceAddr(ctx, &results[i]); err != nil {
			return results, err
		}
	}
	return results, nil
}
1271229
func (s *Service) SetServiceRegistries(v []*ServiceRegistry) *Service {
	s.ServiceRegistries = v
	return s
}
1149139
func NewCache() Cache {
	return &cache{pods: map[types.UID]*data{}, subscribers: map[types.UID][]*subRecord{}}
}
343573
func (cache *Cache) IterateCachedStorage(address crypto.Address,
	consumer func(key, value binary.Word256) error) error {
	accInfo, err := cache.get(address)
	if err != nil {
		return err
	}
	accInfo.RLock()
	// Try cache first for early exit
	for key, value := range accInfo.storage {
		if err := consumer(key, value); err != nil {
			accInfo.RUnlock()
			return err
		}
	}
	accInfo.RUnlock()
	return err
}
1057452
func (e *edge) loadCache(ctx context.Context) (interface{}, error) {
	recs := make([]*CacheRecord, 0, len(e.cacheRecords))
	for _, r := range e.cacheRecords {
		recs = append(recs, r)
	}

	rec := getBestResult(recs)

	logrus.Debugf("load cache for %s with %s", e.edge.Vertex.Name(), rec.ID)
	res, err := e.op.LoadCache(ctx, rec)
	if err != nil {
		return nil, err
	}

	return NewCachedResult(res, []ExportableCacheKey{{CacheKey: rec.key, Exporter: &exporter{k: rec.key, record: rec, edge: e}}}), nil
}
585957
func RegisterLRUCache(capacity int) LRUHandle {
	checkStillInitTime()
	registeredCaches = append(registeredCaches, registeredCache{capacity})
	return LRUHandle(len(registeredCaches) - 1)
}
1011392
func (engine *Engine) MapCacher(bean interface{}, cacher core.Cacher) {
	v := rValue(bean)
	tb := engine.autoMapType(v)
	tb.Cacher = cacher
}
642565
func (r ChainedProviderRegistry) StorageProvider(t ProviderType) (Provider, error) {
	for _, r := range r {
		p, err := r.StorageProvider(t)
		if err == nil {
			return p, nil
		}
		if errors.IsNotFound(err) {
			continue
		}
		return nil, errors.Annotatef(err, "getting storage provider %q", t)
	}
	return nil, errors.NotFoundf("storage provider %q", t)
}
1270292
func (c *CDN) PushObjectCache(objectPath string, resp interface{}) (err error) {
	if objectPath == global.EmptyString {
		return errors.New("objectPath should not be empty")
	}
	req := c.cdnReq.Clone().(*Request)
	req.Action = PushObjectCacheAction
	req.SetArgs("ObjectPath", objectPath)
	err = c.rpc.Query(req, resp)
	return
}
439878
func (s *CreateTaskSetInput) SetServiceRegistries(v []*ServiceRegistry) *CreateTaskSetInput {
	s.ServiceRegistries = v
	return s
}
1267784
func NewTriggerCache() cache.ThreadSafeStore {
	return cache.NewThreadSafeStore(
		cache.Indexers{
			"images": triggerCacheIndexer,
		},
		cache.Indices{},
	)
}
894926
func BuildProcedures(s Service, opts ...RegisterOption) []transport.Procedure {
	var rc registerConfig
	for _, opt := range opts {
		opt.applyRegisterOption(&rc)
	}

	proto := protocol.Binary
	if rc.Protocol != nil {
		proto = rc.Protocol
	}

	svc := s.Name
	if rc.ServiceName != "" {
		svc = rc.ServiceName
	}

	rs := make([]transport.Procedure, 0, len(s.Methods))

	for _, method := range s.Methods {
		var spec transport.HandlerSpec
		switch method.HandlerSpec.Type {
		case transport.Unary:
			spec = transport.NewUnaryHandlerSpec(thriftUnaryHandler{
				UnaryHandler: method.HandlerSpec.Unary,
				Protocol:     proto,
				Enveloping:   rc.Enveloping,
			})
		case transport.Oneway:
			spec = transport.NewOnewayHandlerSpec(thriftOnewayHandler{
				OnewayHandler: method.HandlerSpec.Oneway,
				Protocol:      proto,
				Enveloping:    rc.Enveloping,
			})
		default:
			panic(fmt.Sprintf("Invalid handler type for %T", method))
		}

		rs = append(rs, transport.Procedure{
			Name:        procedure.ToName(svc, method.Name),
			HandlerSpec: spec,
			Encoding:    Encoding,
			Signature:   method.Signature,
		})
	}
	return rs
}