olric
olric copied to clipboard
Question - Is there any way to trigger an action when some items are expired?
I have the following scenario if you could help me to find the best approach by using this library - that will be great.
I have a server - which is monitoring some devices and sends this data to my application, now I have to update the main DB only when the status of the device has been changed. For example, let's say I have a device - dev1 which is offline at the moment (status 0), then when it came online server will send a notification to the app that dev1 became online and my application will update the main DB status - from 0 to 1, everything seems to be straight forward. The problem here is that the server is not sending any notification when the device is offline, so in case dev1 is already online and then for some reason it's going offline - then my application wouldn't know about that and will keep the status online in the main DB even if that dev is long time offline.
My thought here was to keep on the map only online devices with some expiration time, and in case some devices expired - that will mean that it's offline, and update the main DB accordingly.
Please let me know if it's possible to do that by using this library.
Thank you.