code: public void clearCache() {
          if (accountCache != null) {
              accountCache.invalidateAll();
          }
          for (Realm realm : allRealms) {
              if (realm instanceof CachingRealm) {
                  CachingRealm cachingRealm = (CachingRealm) realm;
                  cachingRealm.clearCache();
              }
          }
      }
docs: Clears the SecurityManager account cache and any CachingRealm's cache.
  MemoryRealms are not affected by this call.