Added memcache caching logic to gateway