class EE::System::RegExCache¶
Overview¶
#include <regex.hpp> class RegExCache { public: // typedefs typedef std::shared_ptr<void> CompiledPattern; // fields static constexpr size_t MaxCachedPatterns = 8192; // methods bool isEnabled() const; void setEnabled(bool enabled); void insert(std::string_view pattern, Uint32 options, CompiledPattern compiled); CompiledPattern find(std::string_view pattern, Uint32 options); size_t size(); void clear(); };
Detailed Documentation¶
Typedefs¶
typedef std::shared_ptr<void> CompiledPattern
A compiled pattern, shared by every RegEx that asked for the same pattern and options. The deleter stored inside it releases the pattern with the engine that compiled it, so a pattern stays valid for as long as a RegEx holds it, even after the cache evicts its entry.
Fields¶
static constexpr size_t MaxCachedPatterns = 8192
Cached patterns are evicted least-recently-used beyond this count. Syntax definitions are the bulk of the working set (every language contributes a few dozen patterns), so this keeps a whole session’s worth resident while bounding the memory the cache can pin.