6 ms·
Another pattern you might consider is setting an expiry date on a database row. You only show values where the expiry date is null. Every night you have a cronj
by gtsteve 9y ago
Another pattern you might consider is setting an expiry date on a database row. You only show values where the expiry date is null. Every night you have a cronjob or some other process that deletes all objects that have expired.
- zimpenfish 9y agoNot sure that would comply with the "without undue delay" requirement unless you always set the expiry date to be today and then you might as well just wipe them immediately.
- pan69 9y agoYou probably already add a "time created" column/field to each row/document (at least, I personally do this to all data I store in a database). If you want to expire something, you can now easily calculate it and you can even easily change the timeout/lifespan without having to update the data in the database.
- raverbashing 9y agoHow would that help? Would you set time created to zero?
- pan69 9y agoRather than having an expire date, with a creation time you can e.g. delete everything older than 1 day, or what ever. I.e. you don't hard code the expire time in the data itself. If you want to change the timeout to 2 days it's a change in your delete logic, not your data.