I have Socket.IO hooked up to a RedisStore such that using "socket.set()" will store its information in my redis database.
It does this by creating some form of random key which I can only assume is the unique identifier for the socket.
My problem is this. From what I can see this data that I save never gets deleted unless I somehow manually delete it. Every new socket is saved and stored but the old ones are never removed unless I do something on disconnect. However this means that if I restart node or have a crash etc this data will persist forever.
My goal is trying to find somewhere to clean the database of old keys. My problem is that I'm having trouble to find a good way to find these old keys.
On idea of a solution I thought of would be to store these key names in a set of some sort. I could then iterate over them and check if they're still in use at start-up. However, as far as I can tell I have no way to find the key being used.
Another though was that I could try and iterate over all keys, but that seems like a bad idea. I also can't properly differentiate the keys they use with keys that I use unless I specifically avoid using keys of a particular length.
So my question is if anyone has a good way to keep my database clean or how can I keep track of the keys that socket.io is using in my database.
Thanks, Sammy
p.s. If you need any more information or I wasn't clear just tell me and I'll do my best to explain.