예제 #1
0
        public ValueTask <IReadOnlyCollection <RoleIdentityViewModel> > GetCurrentIdentitiesAsync(
            CancellationToken cancellationToken)
        => _memoryCache.OptimisticGetOrCreateAsync <IReadOnlyCollection <RoleIdentityViewModel> >(_getCurrentIdentitiesCacheKey, async entry =>
        {
            RolesLogMessages.RoleIdentitiesFetchingCurrent(_logger);

            entry.Priority = CacheItemPriority.High;

            var result = await _rolesRepository.AsyncEnumerateIdentities(
                isDeleted: false)
                         .ToArrayAsync(cancellationToken);
            RolesLogMessages.RoleIdentitiesFetchedCurrent(_logger);

            return(result);
        });