Add in-memory caching with tests.