From bf34fde333e9a6e0e50bb1d3c1cf16d5754ae913 Mon Sep 17 00:00:00 2001 From: John Turner Date: Sun, 21 Sep 2025 13:58:50 -0400 Subject: add lru cache to pygmentize function --- pypaste/server/__init__.py | 2 ++ 1 file changed, 2 insertions(+) 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: -- cgit v1.2.3