Caching mechanism for in-memory retention of data