tiled.adapters.resource_cache.with_resource_cache

tiled.adapters.resource_cache.with_resource_cache(cache_key: Any, factory: Callable[[...], Any], *args: Any, _resource_cache: Cache | None = None, **kwargs: Any) Any[source]

Use value from cache or, if not present, call factory(*args, **kwargs) and cache result.

This uses a globally configured resource cache by default. For testing and debugging, a cache may be passed to the parameter _resource_cache.

Parameters:
cache_key
factory
args
_resource_cache
kwargs
Returns: