
    Xj                     T    d dl mZ d dlmZmZ d dlmZ d dlmZ  G d de      Z	dgZ
y)    )	lru_cache)IteratorOptional)SchemaExtension)parse_documentc                   :    e Zd ZdZddee   ddfdZded   fdZy)ParserCachea7  Add LRU caching the parsing step during execution to improve performance.

    Example:

    ```python
    import strawberry
    from strawberry.extensions import ParserCache

    schema = strawberry.Schema(
        Query,
        extensions=[
            ParserCache(maxsize=100),
        ],
    )
    ```
    Nmaxsizereturnc                 :     t        |      t              | _        y)a  Initialize the ParserCache.

        Args:
            maxsize: Set the maxsize of the cache. If `maxsize` is set to `None` then the
                cache will grow without bound.
                More info: https://docs.python.org/3/library/functools.html#functools.lru_cache
        )r
   N)r   r   cached_parse_document)selfr
   s     o/var/www/html/myl_app/scheduler-service/venv/lib/python3.12/site-packages/strawberry/extensions/parser_cache.py__init__zParserCache.__init__   s     &@Yw%?%O"    c              #      K   | j                   } | j                  |j                  fi |j                  |_        d  y wN)execution_contextr   queryparse_optionsgraphql_document)r   r   s     r   on_parsezParserCache.on_parse$   sD      22-GT-G-G##.
'8'F'F.
* 	s   >A r   )	__name__
__module____qualname____doc__r   intr   r   r    r   r   r	   r	      s1    "P P P(4. r   r	   N)	functoolsr   typingr   r   $strawberry.extensions.base_extensionr   strawberry.schema.executer   r	   __all__r   r   r   <module>r$      s'     % @ 4"/ "J /r   