Define persistence for the in-memory data. Could be combined with JPA as persistence provider if keys and values are JPA entities. Or in a light-weight solution, ensure that cache listeners can be used to cover all CRUD operations and synchronize cache with a persistence layer.