code: func (c *patternCache) translate(pat string) (*regexp.Regexp, error) {
  	c.RLock()
  	val, ok := c.cache[pat]
  	c.RUnlock()
  	if ok {
  		return val.re, val.err
  	}
  
  	c.Lock()
  	defer c.Unlock()
  	if val, ok := c.cache[pat]; ok {
  		return val.re, val.err
  	}
  
  	if c.cache == nil || len(c.cache) > 500 {
  		c.cache = map[string]cacheEntry{}
  	}
  
  	var re *regexp.Regexp
  	reStr, err := translate(pat)
  	if err == nil {
  		re, err = regexp.Compile(reStr)
  	}
  
  	c.cache[pat] = cacheEntry{re, err}
  	return re, err
  }
docs: // translate grabs converted regexp from cache or calls 'translate' to get it.