<@ULVA73B9P> Is there a way in prefect to clear ex...
# marvin-ai
i
@Marvin Is there a way in prefect to clear expired task run cache automatically?
m
thought for 350.7 seconds
Short answer: not today. In Prefect 3.x, expired task-run cache entries are ignored at read time but they are not automatically deleted from storage. There’s no built-in service, setting, or CLI command to sweep/prune expired cache. What you can do instead: - If you use a cloud object store (S3/GCS/Azure), set a lifecycle/retention policy on the cache/result prefix to auto-delete objects older than your TTL. - If you use local storage (the default is under your Prefect home, typically ~/.prefect/storage/), run a periodic OS-level cleanup (cron/systemd timer) to delete old files by age, for example:
Copy code
# delete files older than 30 days
  find ~/.prefect/storage -type f -mtime +30 -delete
- Keep cache growth in check by setting shorter
cache_expiration
on your tasks. Docs for reference: - Caching concepts - Advanced caching If you can share what result/cache backend you’re using (local disk, S3, GCS, etc.) and your desired retention window, I can suggest a concrete cleanup approach or a small maintenance script.