More retry code out of memcached

So we can use for other drivers.

Change-Id: I2f0b9f5faeaf5c4506df30076499102a3293038c