I was thinking that redis needs a RESET command that would make an existing client connection forget all the state it keeps with regards to transactions, watches, pubsub channels (and everything else that might be stateful in the future) and always returns always successfully OK or RESET (the latter might be easier to look for without parsing the sent commands).
This can be very useful in the context of a client library which uses connection pooling.
If you want to reuse an existing socket connection to the server in the pool, you must be sure that the connection is in an empty state before adding it back to the pool, since the user might issue commands that are not-safe between different contexts.
Doing it manually requires quite a bit of parsing and book keeping with regards to which commands were sent and what their side effects are (and if they executed ok).
I was thinking that redis needs a RESET command that would make an existing client connection forget all the state it keeps with regards to transactions, watches, pubsub channels (and everything else that might be stateful in the future) and always returns always successfully OK or RESET (the latter might be easier to look for without parsing the sent commands).
This can be very useful in the context of a client library which uses connection pooling.
If you want to reuse an existing socket connection to the server in the pool, you must be sure that the connection is in an empty state before adding it back to the pool, since the user might issue commands that are not-safe between different contexts.
Doing it manually requires quite a bit of parsing and book keeping with regards to which commands were sent and what their side effects are (and if they executed ok).