https://prefect.io logo
Title
j

Jamie Blakeman

08/09/2022, 8:58 AM
Hi all, using prefect 2.0.3, is there a way to forcibly expire a cache key?
a

Anna Geller

08/09/2022, 9:42 AM
Not that I'm aware of, the easiest is by setting expiration time
j

Jamie Blakeman

08/09/2022, 9:49 AM
Hi Anna, thanks for the reply, thought so Issue I’ve come across is: I’m setting a three day expiration time as that’s appropriate for the result of the task, cache is working great on the repeat runs I then discovered a downstream bug that required tweaking the cached task to return an additional value, code works fine in pure python, but in prefect, as expected the old cached result is being returned with only one return value, hence the desire to expire the cache key manually I’m hesitant to include something like the git commit hash into the cache key as in 99% of cases I won’t want to lose the cached output if I have to bug fix
a

Anna Geller

08/09/2022, 9:58 AM
The easiest would be to rename the task before you rerun, this way there is no cache anymore and you can start this task from scratch
🙌 1
j

Jamie Blakeman

08/09/2022, 9:59 AM
that’s great, thank you!