update invalidates the regular expression for the given pattern. If a new regular expression is passed in, it is inserted into the cache.
(key RegexpCacheKey, re *regexp.Regexp)
| 113 | // update invalidates the regular expression for the given pattern. |
| 114 | // If a new regular expression is passed in, it is inserted into the cache. |
| 115 | func (rc *RegexpCache) update(key RegexpCacheKey, re *regexp.Regexp) { |
| 116 | rc.mu.Lock() |
| 117 | defer rc.mu.Unlock() |
| 118 | rc.cache.Del(key) |
| 119 | if re != nil { |
| 120 | rc.cache.Add(key, re) |
| 121 | } |
| 122 | } |
| 123 | |
| 124 | // Len returns the number of compiled regular expressions in the cache. |
| 125 | func (rc *RegexpCache) Len() int { |
no test coverage detected