memcached refactoring part one