Hi,
Hoping someone can suggest a way in doing the following..
What I am trying to do is, I am inserting a value into a MySQL database, but I want to delete the value I inserted in 24 hours.
What would be the best way in deleting the value 24 hours after it has been added in the MySQL database ?
I also want to make it so if I re-start the B4J app it will still delete the value in 24 hours when the B4J is running again. (so if I add the value in the database, wait 5 hours, and then kill the B4J app and start it again a minute or so later then it will still delete the value in 19 hours, providing the B4J is running.)
I am wanting to do this in a non-UI app.
The only way I thought of doing this was:
- In the MySQL database add a column for a timestamp and value.
- When I insert the value into the database, then also add it to the map in B4J.
- When the app is opened, connect to the database and load the timestamp and value into a map in the B4J app.
- Run a timer every 30 seconds which will check the map timestamp, and if the timestamp is more then 24 hours since it was created then delete the value out of the database (and delete it from the map).
Is there any better ways in doing this, or is the above the best way in doing this ?
Hoping someone can suggest a way in doing the following..
What I am trying to do is, I am inserting a value into a MySQL database, but I want to delete the value I inserted in 24 hours.
What would be the best way in deleting the value 24 hours after it has been added in the MySQL database ?
I also want to make it so if I re-start the B4J app it will still delete the value in 24 hours when the B4J is running again. (so if I add the value in the database, wait 5 hours, and then kill the B4J app and start it again a minute or so later then it will still delete the value in 19 hours, providing the B4J is running.)
I am wanting to do this in a non-UI app.
The only way I thought of doing this was:
- In the MySQL database add a column for a timestamp and value.
- When I insert the value into the database, then also add it to the map in B4J.
- When the app is opened, connect to the database and load the timestamp and value into a map in the B4J app.
- Run a timer every 30 seconds which will check the map timestamp, and if the timestamp is more then 24 hours since it was created then delete the value out of the database (and delete it from the map).
Is there any better ways in doing this, or is the above the best way in doing this ?