Memcached refactoring + unit-tests