implemented caching for requireWithContext