Replace datastore with memcache

Use the memcache compare and set function to get rid of lock.
Unit tests added.
@tkchin @juberti