Skip to content

Commit

Permalink
Increase regex cache for faster retrieval
Browse files Browse the repository at this point in the history
Change-Id: I500ee5337bb3ba7f6106603b777a786b4c6cfbab
  • Loading branch information
rseltmann committed Sep 9, 2024
1 parent 988257b commit 5b75b07
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions packages/cmk-agent-based/cmk/agent_based/v1/_regex.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@
# This file is part of Checkmk (https://checkmk.com). It is subject to the terms and
# conditions defined in the file COPYING, which is part of this source code package.
import re
from collections.abc import Callable
from typing import TYPE_CHECKING, TypeVar

if TYPE_CHECKING:
F = TypeVar("F")

def lru_cache(_f: F) -> F:
def lru_cache(maxsize: int) -> Callable[[F], F]: # pylint: disable=unused-argument
pass

else:
Expand All @@ -17,7 +18,7 @@ def lru_cache(_f: F) -> F:
__all__ = ["regex"]


@lru_cache
@lru_cache(maxsize=2048)
def regex(pattern: str, flags: int = 0) -> re.Pattern[str]:
"""Cache compiled regexes.
Expand Down

0 comments on commit 5b75b07

Please sign in to comment.