getByMember

Signed-off-by: vramik <vramik@redhat.com>
This commit is contained in:
vramik 2024-06-13 09:20:11 +02:00 committed by Pedro Igor
parent de2fdbe98f
commit 8f72a77582
2 changed files with 4 additions and 8 deletions

View file

@ -154,8 +154,7 @@ public class InfinispanOrganizationProvider implements OrganizationProvider {
@Override @Override
public OrganizationModel getByMember(UserModel member) { public OrganizationModel getByMember(UserModel member) {
// Return cache delegate to ensure cache invalidation during write operations return orgDelegate.getByMember(member);
return getCacheDelegate(orgDelegate.getByMember(member));
} }
@Override @Override
@ -235,11 +234,7 @@ public class InfinispanOrganizationProvider implements OrganizationProvider {
return realm; return realm;
} }
private OrganizationModel getCacheDelegate(OrganizationModel model) {
return model == null ? null : getById(model.getId());
}
private Stream<OrganizationModel> getCacheDelegates(Stream<OrganizationModel> backendOrganizations) { private Stream<OrganizationModel> getCacheDelegates(Stream<OrganizationModel> backendOrganizations) {
return backendOrganizations.map(this::getCacheDelegate); return backendOrganizations.map(OrganizationModel::getId).map(this::getById);
} }
} }

View file

@ -274,7 +274,8 @@ public class JpaOrganizationProvider implements OrganizationProvider {
return null; return null;
} }
return getById(orgId); // need to go via the session to avoid bypassing the cache
return session.getProvider(OrganizationProvider.class).getById(orgId);
} }
@Override @Override