Having to do two exec() calls, and having to do them in serial isn't going to be as fast as just doing one.

I think it would be better to add a parameter to the 'set' command saying whether it should return the old values to the callback. That way you can merge these two if blocks, and also use only a single exec() call.