Is there TTL can we set for record inserts?
Is there anyway to set the TTL for record mutations, trying to auto delete data persisted to the database after 30 minutes.
3 Replies
You can effectively have TTL by scheduling deletion at the same time as insertion. You can use the
runAfter
method to run a delete record mutation. Docs here: https://docs.convex.dev/scheduling/scheduled-functions#scheduling-from-mutationsScheduled Functions | Convex Developer Hub
Convex allows you to schedule functions to run in the future. This allows you to
@Sean Knowles here's a demo project that does this: https://github.com/get-convex/convex-demos/blob/main/scheduling/convex/messages.ts#L18
GitHub
convex-demos/scheduling/convex/messages.ts at main · get-convex/con...
Demo apps built on Convex. Contribute to get-convex/convex-demos development by creating an account on GitHub.
sendExpiringMessage
schedules a delayed deletion mutation upon insertion