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

Function NewRegexpCache

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

NewRegexpCache creates a new RegexpCache of the given size. The underlying cache internally uses a hash map, so lookups are cheap.

(size int)

Source from the content-addressed store, hash-verified

34// The underlying cache internally uses a hash map, so lookups
35// are cheap.
36func NewRegexpCache(size int) *RegexpCache {
37 return &RegexpCache{
38 cache: cache.NewUnorderedCache(cache.Config{
39 Policy: cache.CacheLRU,
40 ShouldEvict: func(s int, key, value interface{}) bool {
41 return s > size
42 },
43 }),
44 }
45}
46
47// GetRegexp consults the cache for the regular expressions stored for
48// the given key, compiling the key's pattern if it is not already

Callers 1

parse.goFile · 0.92

Calls 1

NewUnorderedCacheFunction · 0.92

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…