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

Method lookup

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

lookup checks for the regular expression in the cache in a synchronized manner, returning it if it exists.

(key RegexpCacheKey)

Source from the content-addressed store, hash-verified

101// lookup checks for the regular expression in the cache in a
102// synchronized manner, returning it if it exists.
103func (rc *RegexpCache) lookup(key RegexpCacheKey) *regexp.Regexp {
104 rc.mu.Lock()
105 defer rc.mu.Unlock()
106 v, ok := rc.cache.Get(key)
107 if !ok {
108 return nil
109 }
110 return v.(*regexp.Regexp)
111}
112
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.

Callers 1

getRegexpInternalMethod · 0.95

Calls 3

GetMethod · 0.65
LockMethod · 0.45
UnlockMethod · 0.45

Tested by

no test coverage detected