/**
  * Clear identity cache.
  *
  * @param identity
  * @param oldRemoteId
  * @since 1.2.8
  */
 public void clearIdentityCached(Identity identity, String oldRemoteId) {
   IdentityKey key = new IdentityKey(new Identity(identity.getId()));
   IdentityData data = exoIdentityCache.remove(key);
   if (data != null) {
     exoIdentityIndexCache.remove(new IdentityCompositeKey(data.getProviderId(), oldRemoteId));
   }
   exoProfileCache.remove(key);
   clearCache();
 }
  /** {@inheritDoc} */
  public void hardDeleteIdentity(final Identity identity) throws IdentityStorageException {

    //
    storage.hardDeleteIdentity(identity);

    //
    IdentityKey key = new IdentityKey(new Identity(identity.getId()));
    IdentityData data = exoIdentityCache.remove(key);
    if (data != null) {
      exoIdentityIndexCache.remove(
          new IdentityCompositeKey(data.getProviderId(), data.getRemoteId()));
    }
    exoProfileCache.remove(key);
    clearCache();
  }