https://prefect.io logo
Title
a

Alex Rogozhnikov

04/08/2022, 8:09 AM
Hello, a question about cache. Is there a scheduled task or function that deletes expired cache?
a

Anna Geller

04/08/2022, 9:39 AM
No need to do that manually; Prefect takes care of that automatically for you. You can set it, e.g. using:
@task(cache_for=timedelta(hours=1))
If you need to clean the cache sooner, you can set it in your task to a lower threshold. If you are asking for Prefect 2.0, LMK since this is a bit different there.
k

Kevin Kho

04/08/2022, 1:45 PM
Are you talking about cache or result or target?
a

Alex Rogozhnikov

04/08/2022, 6:50 PM
I'm talking about cache. I want to make sure that really old cache is not piling up indefinitely
k

Kevin Kho

04/08/2022, 6:54 PM
But the cache is not what piles up because it’s just a state stored in the Prefect database
a

Alex Rogozhnikov

04/08/2022, 6:54 PM
(I use cache_for=...)
ok, if that's in DB, that's probably auto-cleared
is there a similar mechanism for results, e.g. S3 results?
k

Kevin Kho

04/08/2022, 6:56 PM
No we don’t have anything that deletes any results. For S3 though, you could do a TTL on the bucket?
a

Alex Rogozhnikov

04/08/2022, 6:58 PM
yeah, I think that would work