mirror of
https://github.com/idanoo/autobrr
synced 2025-07-23 08:49:13 +00:00
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:
parent
3af06553e7
commit
e9f8730ca0
5 changed files with 279 additions and 48 deletions
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue