regexcache

package
v0.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 3, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package regexcache provides a process-wide, size-bounded cache of compiled regular expressions.

Regex patterns in AltMount frequently originate from user configuration or API request payloads (scoring rules, exclude keywords, custom formats). Caching them unboundedly lets unique per-request patterns accumulate forever and grow heap usage indefinitely, so the cache resets once it exceeds a cap; hot patterns are rebuilt lazily on the next miss.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Get

func Get(pattern string) (*regexp.Regexp, error)

Get returns the compiled pattern, compiling and caching it on first use. Patterns without an explicit case directive are compiled case-insensitive, mirroring the historical behavior at each former call site. It returns (nil, err) when the pattern does not compile; failed patterns are never cached so transient inputs cannot poison the cache.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL