Infrastructure code for managing a cache within direct memory