Skip to content

Commit

Permalink
✨ Add lru_cache to load_class and set maxsize
Browse files Browse the repository at this point in the history
Signed-off-by: ff137 <[email protected]>
  • Loading branch information
ff137 committed Nov 27, 2024
1 parent 1131bd9 commit c13e645
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion acapy_agent/utils/classloader.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class ClassLoader:
"""Class used to load classes from modules dynamically."""

@classmethod
@lru_cache
@lru_cache(maxsize=1024)
def load_module(
cls, mod_path: str, package: Optional[str] = None
) -> Optional[ModuleType]:
Expand Down Expand Up @@ -84,6 +84,7 @@ def load_module(
raise ModuleLoadError(f"Unable to import module {full_path}: {str(e)}") from e

@classmethod
@lru_cache(maxsize=1024)
def load_class(
cls,
class_name: str,
Expand Down

0 comments on commit c13e645

Please sign in to comment.