示例#1
0
        public async Task ClearAllCaches()
        {
            await Task.FromResult(1);

            CachingStrategyContext    _CachingStrategyContext    = IResolver.Current.CachingStrategyContext;
            CachingRepositoryStrategy _CachingRepositoryStrategy = IResolver.Current.CachingRepositoryStrategy;
            CachingModuleStrategy     _CachingModuleStrategy     = IResolver.Current.CachingModuleStrategy;

            _CachingStrategyContext.SetStrategy(_CachingRepositoryStrategy);
            await ClearCache(_CachingStrategyContext);

            _CachingStrategyContext.SetStrategy(_CachingModuleStrategy);
            await ClearCache(_CachingStrategyContext);
        }
示例#2
0
        public async Task <bool> AddToRepositoryCache(string functionName, string key, object obj, short minutesBeforeExpiration)
        {
            await Task.FromResult(1);

            CachingStrategyContext    _CachingStrategyContext    = IResolver.Current.CachingStrategyContext;
            CachingRepositoryStrategy _CachingRepositoryStrategy = IResolver.Current.CachingRepositoryStrategy;

            _CachingStrategyContext.SetStrategy(_CachingRepositoryStrategy);

            return(await AddToCache(_CachingStrategyContext, functionName, key, obj, minutesBeforeExpiration));
        }
示例#3
0
        public async Task <bool> AddToModuleCache(string functionName, string key, string retStr)
        {
            await Task.FromResult(1);

            CachingStrategyContext _CachingStrategyContext = IResolver.Current.CachingStrategyContext;
            CachingModuleStrategy  _CachingModuleStrategy  = IResolver.Current.CachingModuleStrategy;

            _CachingStrategyContext.SetStrategy(_CachingModuleStrategy);

            return(await AddToCache(_CachingStrategyContext, functionName, key, retStr));
        }
示例#4
0
        public object GetDataFromRepositoryCache(string functionName, string key)
        {
            CachingStrategyContext    _CachingStrategyContext    = IResolver.Current.CachingStrategyContext;
            CachingRepositoryStrategy _CachingRepositoryStrategy = IResolver.Current.CachingRepositoryStrategy;

            _CachingStrategyContext.SetStrategy(_CachingRepositoryStrategy);

            string strCacheKey = string.Concat(functionName, "-", key);
            var    objCache    = _CachingStrategyContext.CacheGetFromKey(strCacheKey);

            return(objCache);
        }
示例#5
0
文件: CacheClient.cs 项目: gittsi/000
        public string GetMessageFromModuleCache(string functionName, string key)
        {
            _cachingStrategyContext.SetStrategy(_cachingModuleStrategy);

            string retStr     = "";
            string loadingStr = "";

            string strCacheKey = string.Concat(functionName, "-", key);
            var    objCache    = _cachingStrategyContext.CacheGetFromKey(strCacheKey);

            if (objCache != null)
            {
                loadingStr = "\n**(cached data^)**";
                retStr     = (string)objCache;
                return(string.Concat(loadingStr, retStr));
            }
            return(string.Empty);
        }