I'm searching materials/ideas/designs to solve architecture problem: I'll have several agents which handle some processing, as a result they can generate state for clients which will expire after some time. Let's say client sent presence state which expire after 1h. I wondering how to write service to keep track of expiration time of scheduled events.
1) create sorted collection with timestamps and process it by some executor
2) put all into DB and perform cyclic check using sorted query
Any suggestions are appreciated.