ContextReadOnlyCache { public void cacheGroupMembership(Group group, EPerson eperson, Boolean isMember) { if (CollectionUtils.isEmpty(allMemberGroupsCache.get(buildAllMembersGroupKey(eperson)))) { groupMembershipCache.put(buildGroupMembershipKey(group, eperson), isMember); } }  Boolean getCachedAuthorizationResult(DSpaceObject dspaceObject, int action, EPerson eperson); void cacheAuthorizedAction(DSpaceObject dspaceObject, int action, EPerson eperson, Boolean result); Boolean getCachedGroupMembership(Group group, EPerson eperson); void cacheGroupMembership(Group group, EPerson eperson, Boolean isMember); void cacheAllMemberGroupsSet(EPerson ePerson, Set<Group> groups); Set<Group> getCachedAllMemberGroupsSet(EPerson ePerson); void clear();  }
@Test public void cacheGroupMembership() throws Exception { Group group1 = buildGroupMock("Test Group 1"); Group group2 = buildGroupMock("Test Group 2"); Group group3 = buildGroupMock("Test Group 3"); readOnlyCache.cacheGroupMembership(group1, ePerson, true); readOnlyCache.cacheGroupMembership(group2, ePerson, false); assertTrue(readOnlyCache.getCachedGroupMembership(group1, ePerson)); assertFalse(readOnlyCache.getCachedGroupMembership(group2, ePerson)); assertNull(readOnlyCache.getCachedGroupMembership(group3, ePerson)); assertNull(readOnlyCache.getCachedGroupMembership(null, ePerson)); assertNull(readOnlyCache.getCachedGroupMembership(group2, null)); }