nv_dfm_core.api.TryFromCache#
- class nv_dfm_core.api.TryFromCache(*, dfm_body=[], dfm_node_id=<factory>, dfm_after=None, dfm_class_name='nv_dfm_core.api.TryFromCache', key)[source]#
Takes a key and tries to get the value from the cache. If the value is not in the cache, the body is executed.
Usage: data = … key = KeyFromExpr(expr=RenderImage(data=data)) with TryFromCache(key=key) as img:
# body content = RenderImage(data=dat) img.cache(content)
Yield(value=img)
- Parameters:
- model_config: ConfigDict = {'extra': 'forbid', 'frozen': True}#
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].