<@ULVA73B9P> Is there a place in the UI to see cac...
# ask-marvin
m
@Marvin Is there a place in the UI to see cached data from task runs?
m
thought for 402.2 seconds
Short answer: you can see that a task used a cached result and its cache metadata in the UI, but you cannot view the actual cached payload/value there. Where to look in the UI (Prefect 3.x): - Open a flow run → click a task run → Task Run Details panel - You’ll see: - State chip shows Cached when a cache hit occurred - Cache Key (when present) - Cache Expiration (when present) - The actual result value is not shown in the UI How to view the cached value - From within your flow, capture the state and load the value:
Copy code
from prefect import flow, task

@task
def my_task(x):
    return x + 1

@flow
def my_flow():
    state = my_task(1, return_state=True)
    if state.name == "Cached":
        print("Used a cached result")
    value = state.result()
    print(value)
- If you have a task run ID, you can load the result via the Python client:
Copy code
from uuid import UUID
from prefect.client.orchestration import get_client

async def load_task_result(task_run_id: str):
    async with get_client() as client:
        task_run = await client.read_task_run(UUID(task_run_id))
        state = task_run.state
        value = await state.result()
        return value
Docs for more detail: - Caching concepts: Caching - States and `state.result()`: States - Result persistence (where results are stored/how they’re loaded): Persist workflow results