During export/import I may want to remove some data (like realm) and
overwrite it with imported one. But actually I have some issues during
testing and looks like it's caused by the fact that not all the data are
properly invalidated during removal of entities.
For example when removing realm, there is just realm itself marked for
. Actually with JPA model, the call to getDelegate().removeRealm(id)
also seems to invalidate application and application roles (due to the
call to getApplicationById() which uses CacheModel) but realm roles,
oauth clients and users are not invalidated. For Mongo model, there are
no data invalidated at all.
Question is if CacheModelProvider should rely on ModelProvider to
invalidate cached data during getDelegate().removeRealm ? Shouldn't it
be the responsibility of CacheModelProvider itself to find all cached
data related to particular realm (in this case all applications, oauth
clients, realm roles, app roles, users) and invalidate them?