code: func (d *memCacheClient) refreshLocked() error {
  	// TODO: Could this multiplicative set of calls be replaced by a single call
  	// to ServerResources? If it's possible for more than one resulting
  	// APIResourceList to have the same GroupVersion, the lists would need merged.
  	gl, err := d.delegate.ServerGroups()
  	if err != nil || len(gl.Groups) == 0 {
  		utilruntime.HandleError(fmt.Errorf("couldn't get current server API group list: %v", err))
  		return err
  	}
  
  	rl := map[string]*cacheEntry{}
  	for _, g := range gl.Groups {
  		for _, v := range g.Versions {
  			r, err := d.serverResourcesForGroupVersion(v.GroupVersion)
  			rl[v.GroupVersion] = &cacheEntry{r, err}
  			if err != nil {
  				utilruntime.HandleError(fmt.Errorf("couldn't get resource list for %v: %v", v.GroupVersion, err))
  			}
  		}
  	}
  
  	d.groupToServerResources, d.groupList = rl, gl
  	d.cacheValid = true
  	return nil
  }
docs: // refreshLocked refreshes the state of cache. The caller must hold d.lock for
  // writing.