Per {@link #findApplicationUserNoCache(String)}, cached for the request using the {@link QueryResultsCache}.
354282
protected ApplicationUser findApplicationUser(final String userName) {
        return queryResultsCache.execute(new Callable<ApplicationUser>() {
            @Override
            public ApplicationUser call() throws Exception {
                return findApplicationUserNoCache(userName);
            }
        }, TenantedAuthorizationFacetDefault.class, "findApplicationUser", userName);
    }
1092609
private User checkExistsAndAuthz(final Cache<String, User> cache, final User user, final AuthenticationBackend authenticationBackend,
            final Set<AuthorizationBackend> authorizers) {
        if (user == null) {
            return null;
        }

        try {
            return cache.get(user.getName(), new Callable<User>() { //no cache miss in case of noop
                @Override
                public User call() throws Exception {
                    if (log.isTraceEnabled()) {
                        log.trace("Credentials for user " + user.getName() + " not cached, return from " + authenticationBackend.getType()
                                + " backend directly");
                    }
                    if (authenticationBackend.exists(user)) {
                        authz(user, null, authorizers); //no role cache because no miss here in case of noop
                        return user;
                    }

                    if (log.isDebugEnabled()) {
                        log.debug("User " + user.getName() + " does not exist in " + authenticationBackend.getType());
                    }
                    return null;
                }
            });
        } catch (Exception e) {
            if (log.isDebugEnabled()) {
                log.debug("Can not check and authorize " + user.getName() + " due to " + e.toString(), e);
            }
            return null;
        }
    }
837446
public void addUserToCache(User user) {
        users.compute(user.getId(), (key, value) -> {
            Optional.ofNullable(value)
                    .map(Reference::get)
                    .filter(oldUser -> oldUser != user)
                    .map(Cleanupable.class::cast)
                    .ifPresent(Cleanupable::cleanup);

            WeakReference<User> result = new WeakReference<>(user, usersCleanupQueue);
            userIdByRef.put(result, key);
            return result;
        });
    }
1156842
@Programmatic
    public ApplicationPermission findByUserAndPermissionValue(final String username, final ApplicationPermissionValue permissionValue) {



        // obtain all permissions for this user, map by its value, and
        // put into query cache (so that this method can be safely called in a tight loop)
        final Map<ApplicationPermissionValue, List<ApplicationPermission>> permissions =
            queryResultsCache.execute(new Callable<Map<ApplicationPermissionValue, List<ApplicationPermission>>>() {
                @Override
                public Map<ApplicationPermissionValue, List<ApplicationPermission>> call() throws Exception {

                    final List<ApplicationPermission> applicationPermissions = findByUser(username);
                    final ImmutableListMultimap<ApplicationPermissionValue, ApplicationPermission> index = Multimaps
                            .index(applicationPermissions, ApplicationPermission.Functions.AS_VALUE);

                    return Multimaps.asMap(index);
                }
                // note: it is correct that only username (and not permissionValue) is the key
                // (we are obtaining all the perms for this user)
            }, ApplicationPermissionRepository.class, "findByUserAndPermissionValue", username);

        // now simply return the permission from the required value (if it exists)
        final List<ApplicationPermission> applicationPermissions = permissions.get(permissionValue);
        return applicationPermissions != null && !applicationPermissions.isEmpty()
                    ? applicationPermissions.get(0)
                    : null;
    }
588810
@Override
    public Cache getCache(String cacheName) throws CacheException
    {
        if (this.cache == null)
        {
            this.cache = createCache(cacheName);
        }

        return this.cache;
    }
1189333
public DataSource<Boolean> isInDiskCache(final ImageRequest imageRequest) {
    final CacheKey cacheKey = mCacheKeyFactory.getEncodedCacheKey(imageRequest, null);
    final SimpleDataSource<Boolean> dataSource = SimpleDataSource.create();
    mMainBufferedDiskCache.contains(cacheKey)
        .continueWithTask(
            new Continuation<Boolean, Task<Boolean>>() {
              @Override
              public Task<Boolean> then(Task<Boolean> task) throws Exception {
                if (!task.isCancelled() && !task.isFaulted() && task.getResult()) {
                  return Task.forResult(true);
                }
                return mSmallImageBufferedDiskCache.contains(cacheKey);
              }
            })
        .continueWith(
            new Continuation<Boolean, Void>() {
              @Override
              public Void then(Task<Boolean> task) throws Exception {
                dataSource.setResult(!task.isCancelled() && !task.isFaulted() && task.getResult());
                return null;
              }
            });
    return dataSource;
  }
1146987
@Programmatic
    public List<ApplicationPermission> findByUserCached(final ApplicationUser user) {
        return queryResultsCache.execute(new Callable<List<ApplicationPermission>>() {
            @Override public List<ApplicationPermission> call() throws Exception {
                return findByUser(user);
            }
        }, ApplicationPermissionRepository.class, "findByUserCached", user);
    }
392562
private void readFromDB4Access()
        throws CacheReloadException
    {
        Statement stmt = null;
        try {
            stmt = Context.getThreadContext().getConnectionResource().createStatement();
            final ResultSet resultset = stmt.executeQuery("select "
                            + "T_UIACCESS.USERABSTRACT "
                            + "from T_UIACCESS "
                            + "where T_UIACCESS.UIABSTRACT=" + getId());
            while (resultset.next()) {
                final long userId = resultset.getLong(1);
                final AbstractUserObject userObject = AbstractUserObject.getUserObject(userId);
                if (userObject == null) {
                    throw new CacheReloadException("user " + userId + " does not exists!");
                } else {
                    getAccess().add(userId);
                }
            }
            resultset.close();
        } catch (final SQLException e) {
            throw new CacheReloadException("could not read access for " + "'" + getName() + "'", e);
        } catch (final EFapsException e) {
            throw new CacheReloadException("could not read access for " + "'" + getName() + "'", e);
        } finally {
            if (stmt != null) {
                try {
                    stmt.close();
                } catch (final SQLException e) {
                    throw new CacheReloadException("could not read access for " + "'" + getName() + "'", e);
                }
            }
        }
    }
1106060
@Action(
            domainEvent = FindUsersByNameDomainEvent.class,
            semantics = SemanticsOf.SAFE
    )
    @MemberOrder(sequence = "100.10.2")
    public List<ApplicationUser> findUsers(
            final @ParameterLayout(named = "Search") String search) {
        return applicationUserRepository.find(search);
    }
1229707
protected final Application ensureApplicationReference() {
        if (this.application == null) {
            assertState();
            Application tmpApp = applicationResolver.getApplication(client, applicationRestUrl);
            if (tmpApp == null) {
                throw new IllegalStateException("ApplicationResolver returned 'null' Application, this is likely a configuration error.");
            }
            this.application = tmpApp;
        }
        return this.application;
    }
56629
@Programmatic
    public List<ApplicationTenancy> findByNameOrPathMatchingCached(final String search) {
        return queryResultsCache.execute(new Callable<List<ApplicationTenancy>>() {
            @Override public List<ApplicationTenancy> call() throws Exception {
                return findByNameOrPathMatching(search);
            }
        }, ApplicationTenancyRepository.class, "findByNameOrPathMatchingCached", search);
    }
392516
protected String userTenancyPathForCached(final ApplicationUser applicationUser) {
        return queryResultsCache.execute(new Callable<String>() {
            @Override
            public String call() throws Exception {
                return userTenancyPathFor(applicationUser);
            }
        }, TenantedAuthorizationFacetDefault.class, "userTenancyPathFor", applicationUser);
    }
951288
@Programmatic
    public ApplicationTenancy findByNameCached(final String name) {
        return queryResultsCache.execute(new Callable<ApplicationTenancy>() {
            @Override
            public ApplicationTenancy call() throws Exception {
                return findByName(name);
            }
        }, ApplicationTenancyRepository.class, "findByNameCached", name);
    }
1335096
private CachedProviderServiceInstance getCachedServiceInstance(
            String serviceName, String providerAddress) {
        
		ServiceInstanceId id = new ServiceInstanceId(serviceName, providerAddress);
		return getCacheServiceInstances().get(id);
       
    }
714102
@WithBridgeMethods(value = MySQLQuery.class, castRequired = true)
    public C noCache() {
        return addFlag(Position.AFTER_SELECT, SQL_NO_CACHE);
    }
213236
@Override
	public void cacheResult(CPRuleUserSegmentRel cpRuleUserSegmentRel) {
		entityCache.putResult(CPRuleUserSegmentRelModelImpl.ENTITY_CACHE_ENABLED,
			CPRuleUserSegmentRelImpl.class,
			cpRuleUserSegmentRel.getPrimaryKey(), cpRuleUserSegmentRel);

		cpRuleUserSegmentRel.resetOriginalValues();
	}
1299517
@Programmatic
    public List<ApplicationPermission> findByRoleAndRuleAndFeatureTypeCached(
            final ApplicationRole role, final ApplicationPermissionRule rule,
            final ApplicationFeatureType type) {
        return queryResultsCache.execute(new Callable<List<ApplicationPermission>>() {
            @Override public List<ApplicationPermission> call() throws Exception {
                return findByRoleAndRuleAndFeatureType(role, rule, type);
            }
        }, ApplicationPermissionRepository.class, "findByRoleAndRuleAndFeatureTypeCached", role, rule, type);
    }