Beispiel #1
0
 public override async Task Insert <T>(T doc)
 {
     string cacheKey = typeof(T).Name;
     await Task.Run(() =>
     {
         var list = _cacheManager.GetCachedData(new CacheItemArgs(cacheKey, ProviderLevel.High), (args) =>
         {
             return(new List <T>());
         });
         list.Add(doc);
     });
 }
Beispiel #2
0
        public void Test()
        {
            var nval = _dataCacheManager.GetCachedData(new CacheItemArgs("testcore", 5), (cargs) =>
            {
                return((long)5);
            });
            var nval2 = _dataCacheManager.IncrementValue("testcore", () =>
            {
                return(10);
            });

            var strResult = $"IncrementValue-Low:{nval}->{nval2}";

            _logger.LogInformation(strResult);

            nval2 = _dataCacheManager.GetCachedDataLocalDistributed("testcoredistributed", (cargs) =>
            {
                return(10);
            }, 1);

            strResult = $"DataLocalDistributed:{nval}->{nval2}";

            _logger.LogInformation(strResult);
        }