refactoring memcache