Generate a memory cache key in the implementation of the cache

Memory cache key generation moved  in memory cache implementation