Optimize write call

A single write call may need several keys in the backend kv store. Let get these
keys one time.

Signed-off-by: Haomai Wang <haomaiwang@gmail.com>