if (cached != null && !cached.getRealm().equals(realm.getId())) {
cached = null;
}
if (cached == null) {
OAuthClientModel model = getDelegate().getOAuthClientById(id, realm);
if (model == null) return null;
if (clientInvalidations.contains(id)) return model;
cached = new CachedOAuthClient(cache, getDelegate(), realm, model);
cache.addCachedOAuthClient(cached);
} else if (clientInvalidations.contains(id)) {