code: private void ifinishedSession(IPerson person) throws GroupsException {
          IGroupMember gm = getGroupMember(person.getEntityIdentifier());
          try {
              final EntityIdentifier entityIdentifier = gm.getEntityIdentifier();
              EntityCachingService.getEntityCachingService()
                      .remove(entityIdentifier.getType(), entityIdentifier.getKey());
          } catch (CachingException ce) {
              throw new GroupsException(
                      "Problem removing group member " + gm.getKey() + " from cache", ce);
          }
      }
docs: Receives notice that the UserInstance has been unbound from the HttpSession. In response, we
  remove the corresponding group member from the cache. We use the roundabout route of creating
  a group member and then getting its EntityIdentifier because we need the EntityIdentifier for
  the group member, which is cached, not the EntityIdentifier for the IPerson, which is not.
  
  @param person org.apereo.portal.security.IPerson