MCPcopy Create free account
hub / github.com/cockroachdb/cockroachdb-parser / update

Method update

pkg/sql/sem/tree/regexp_cache.go:115–122  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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.
115func (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.
125func (rc *RegexpCache) Len() int {

Callers 1

getRegexpInternalMethod · 0.95

Calls 4

DelMethod · 0.80
AddMethod · 0.65
LockMethod · 0.45
UnlockMethod · 0.45

Tested by

no test coverage detected