feat(filters): wildcard slice matching optimizations (#1716)

* chore(tests): add more test cases
* chore(tests): add code comments for matching patterns
* chore(tests): fix typos

---------

Co-authored-by: martylukyy <35452459+martylukyy@users.noreply.github.com>
This commit is contained in:
Kyle Sanderson 2024-09-14 02:31:26 -07:00 committed by GitHub
parent 3af06553e7
commit e9f8730ca0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 279 additions and 48 deletions

View file

@ -69,3 +69,16 @@ func Compile(pattern string) (*regexp.Regexp, error) {
cache.Set(pattern, reg, ttlcache.DefaultTTL)
return reg, nil
}
func SubmitOriginal(plain string, reg *regexp.Regexp) {
cache.Set(plain, reg, ttlcache.DefaultTTL)
}
func FindOriginal(plain string) (*regexp.Regexp, bool) {
item := cache.Get(plain)
if item != nil {
return item.Value(), true
}
return nil, false
}