small refactor on memcache_hash method