Пример #1
0
        public async Task <string> GetStrSetting(string settingName)
        {
            if (string.IsNullOrEmpty(settingName))
            {
                throw new CallerException("Valid Setting Name Required");
            }

            string settingValue = await Cache.Get <string>(GetCacheKey(settingName));

            if (settingValue != null)
            {
                return(settingValue);
            }

            var setting = await GetSetting(settingName);

            if (setting == null || setting.SettingValue == null)
            {
                settingValue = "";
            }
            else
            {
                settingValue = setting.SettingValue;
            }

            await Cache.Insert(GetCacheKey(settingName), settingValue, new TimeSpan(6, 0, 0));

            return(settingValue);
        }
Пример #2
0
        public async Task<string> CreateCode(int userId, string client_id, string code_challenge)
        {
            string code = Guid.NewGuid().ToString();

            var codeData = new AuthCodeData
            {
                ClientId = client_id,
                CodeChallenge = code_challenge,
                UserId = userId
            };

            await Cache.Insert(GetCacheKey(code), codeData, new TimeSpan(0, 0, CODE_VALID_TIME));

            return code;
        }
Пример #3
0
        internal async Task AddSiteListToCache(List <SiteList> siteLists, bool isAdmin)
        {
            var key = GetCacheKey(isAdmin);

            await Cache.Insert(key, siteLists, new TimeSpan(CACHE_TIME_IN_HOURS, 0, 0));
        }
Пример #4
0
        internal async Task AddUserRolesToCache(int userId, List <UserRole> roles, bool isAdmin)
        {
            var key = GetCacheKey(userId, isAdmin);

            await Cache.Insert(key, roles, new TimeSpan(CACHE_TIME_IN_HOURS, 0, 0));
        }
Пример #5
0
        public async Task AddUserToCache(BudgetUser user)
        {
            var key = GetCacheKey(user.UserId);

            await Cache.Insert(key, user, new TimeSpan(CACHE_TIME_IN_HOURS, 0, 0));
        }
Пример #6
0
        internal async Task AddListEntryToCache(int listId, List <SiteListEntry> siteLists, bool isAdmin)
        {
            var key = GetCacheKey(listId, isAdmin);

            await Cache.Insert(key, siteLists, new TimeSpan(CACHE_TIME_IN_HOURS, 0, 0));
        }
Пример #7
0
        internal async Task AddAppToCache(string clientId, AppModel app)
        {
            var Key = GetCacheKey(clientId);

            await Cache.Insert(Key, app, new TimeSpan(CACHE_TIME_IN_HOURS, 0, 0));
        }
Пример #8
0
        internal async Task AddSearchResponseToCache(Page <UserSearchResponse> response, UserSearch searchOptions)
        {
            var key = GetCacheKey(searchOptions);

            await Cache.Insert(key, response, new TimeSpan(0, CACHE_TIME_IN_MINUTES, 0));
        }
Пример #9
0
        public async Task AddProfilePropertiesToCache(List <ProfileProperty> profileProperties, bool requiredOnly, bool isAdmin)
        {
            var key = GetCacheKey(requiredOnly, isAdmin);

            await Cache.Insert(key, profileProperties, new TimeSpan(CACHE_TIME_IN_HOURS, 0, 0));
        }
Пример #10
0
        internal async Task AddRolesToCache(List <Role> roles, bool isAdmin)
        {
            var Key = GetCacheKey(isAdmin);

            await Cache.Insert(Key, roles, new TimeSpan(CACHE_TIME_IN_HOURS, 0, 0));
        }
        public async Task AddUserProfilePropertiesToCache(int userId, bool showAdminProperties, List <UserProfileProperty> userProfileProperties)
        {
            var key = GetCacheKey(userId, showAdminProperties);

            await Cache.Insert(key, userProfileProperties, new TimeSpan(CACHE_TIME_IN_HOURS, 0, 0));
        }