Trying to plug memory leak by clearing entitymanager each time a cache entry is retrieved and stored