Skip to content

cache

Mais function to xpdeep.

USE_CACHE = ContextVar('USE_CACHE', default=True) #

cache() -> Generator[None, None, None] #

Context manager to use the cache system.

Source code in src/xpdeep/cache.py
@contextmanager
def cache() -> Generator[None, None, None]:
    """Context manager to use the cache system."""
    token = USE_CACHE.set(True)
    yield
    USE_CACHE.reset(token)

no_cache() -> Generator[None, None, None] #

Context manager to not use the cache system.

Source code in src/xpdeep/cache.py
@contextmanager
def no_cache() -> Generator[None, None, None]:
    """Context manager to not use the cache system."""
    token = USE_CACHE.set(False)
    yield
    USE_CACHE.reset(token)