Hi there. Does anyone know if there is a way to us...
# ask-community
t
Hi there. Does anyone know if there is a way to use caching at the transaction level? In the docs, examples show use cases where the result is written to disk as part of the task itself. See fore instance:
Copy code
@flow(log_prints=True)
def pipeline():
    with transaction(key="download-and-write-data") as txn:
        if txn.is_committed():
            print("Data file has already been written. Exiting early.")
            return
        data = download_data()
        write_data(data)
I'd like to do something like:
Copy code
@flow(log_prints=True, persist_result=True)
def pipeline():
    with transaction(key="download-data") as txn:
        if txn.is_committed():
            return txn.result()  #  Get persisted result somehow
        else:
            return download_data()
The docs mention the fact that records are written to disk for each transaction, but I don't know what it contains.