
    Xjv                     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)validate_documentc                   :    e Zd ZdZddee   ddfdZded   fdZy)ValidationCacheaA  Add LRU caching the validation step during execution to improve performance.

    Example:
    ```python
    import strawberry
    from strawberry.extensions import ValidationCache

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

        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_validate_document)selfr
   s     s/var/www/html/myl_app/scheduler-service/venv/lib/python3.12/site-packages/strawberry/extensions/validation_cache.py__init__zValidationCache.__init__   s     )C	'(BCT(U%    c              #      K   | j                   }| j                  |j                  j                  |j                  |j
                        }||_        d  y wN)execution_contextr   schema_schemagraphql_documentvalidation_ruleserrors)r   r   r   s      r   on_validatezValidationCache.on_validate$   sQ      22..$$,,....

 $* s   AAr   )	__name__
__module____qualname____doc__r   intr   r   r    r   r   r	   r	      s1     	V 	V 	V	Xd^ 	r   r	   N)	functoolsr   typingr   r   $strawberry.extensions.base_extensionr   strawberry.schema.executer   r	   __all__r    r   r   <module>r&      s(     % @ 7%o %P 
r   