.. index:: pair: class; EE::System::RegExCache .. _doxid-class_e_e_1_1_system_1_1_reg_ex_cache: class EE::System::RegExCache ============================ .. toctree:: :hidden: Overview ~~~~~~~~ .. ref-code-block:: cpp :class: doxyrest-overview-code-block #include class RegExCache { public: // typedefs typedef std::shared_ptr :ref:`CompiledPattern`; // fields static constexpr size_t :ref:`MaxCachedPatterns` = 8192; // methods bool :target:`isEnabled`() const; void :target:`setEnabled`(bool enabled); void :target:`insert`(std::string_view pattern, :ref:`Uint32` options, :ref:`CompiledPattern` compiled); :ref:`CompiledPattern` :target:`find`(std::string_view pattern, :ref:`Uint32` options); size_t :target:`size`(); void :target:`clear`(); }; .. _details-class_e_e_1_1_system_1_1_reg_ex_cache: Detailed Documentation ~~~~~~~~~~~~~~~~~~~~~~ Typedefs -------- .. index:: pair: typedef; CompiledPattern .. _doxid-class_e_e_1_1_system_1_1_reg_ex_cache_1a22074c2e885c91465d5095fcb80fe8ef: .. ref-code-block:: cpp :class: doxyrest-title-code-block typedef std::shared_ptr CompiledPattern A compiled pattern, shared by every :ref:`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 :ref:`RegEx ` holds it, even after the cache evicts its entry. Fields ------ .. index:: pair: variable; MaxCachedPatterns .. _doxid-class_e_e_1_1_system_1_1_reg_ex_cache_1ab4a7509c98985b788f7e271a8ebbc08c: .. ref-code-block:: cpp :class: doxyrest-title-code-block 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.