diff options
author | John Turner <jturner.usa@gmail.com> | 2025-09-21 13:58:50 -0400 |
---|---|---|
committer | John Turner <jturner.usa@gmail.com> | 2025-09-21 13:58:50 -0400 |
commit | bf34fde333e9a6e0e50bb1d3c1cf16d5754ae913 (patch) | |
tree | 946ebfc91433061d0f8757f91cf92c02288b3a9a | |
parent | 78e3909ca43b7eb6e1ed08edbdae78a6d582fcde (diff) | |
download | pypaste-bf34fde333e9a6e0e50bb1d3c1cf16d5754ae913.tar.gz |
add lru cache to pygmentize function
-rw-r--r-- | pypaste/server/__init__.py | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/pypaste/server/__init__.py b/pypaste/server/__init__.py index 8357949..5f34338 100644 --- a/pypaste/server/__init__.py +++ b/pypaste/server/__init__.py @@ -27,8 +27,10 @@ from pygments.styles import get_style_by_name from abc import abstractmethod from secrets import choice from pypaste import WORDLIST +from functools import lru_cache +@lru_cache(16) def pygmentize( content: str, syntax: Optional[str], style: str, line_numbers: str | bool ) -> str: |