Ejemplo n.º 1
0
        private async Task <DsCountResponse> GetCountResponse(DsRequest request)
        {
            Stopwatch sw = new Stopwatch();

            sw.Start();
            string          hash = request.GenHash();
            DsCountResponse response;
            string          memKey = "countresponse" + hash;

            if (!memoryCache.TryGetValue(memKey, out response))
            {
                response = await StatsService.GetCount(context, request);

                memoryCache.Set(memKey, response, CacheService.RankingCacheOptions);
                cacheService.AddHashKey(memKey);
            }
            sw.Stop();
            logger.LogInformation($"Get count response in {sw.ElapsedMilliseconds} ms");
            return(response);
        }
Ejemplo n.º 2
0
 private async Task <DsCountResponse> GetCountResponse(DsRequest request)
 {
     return(await StatsService.GetCount(context, request));
 }
        #pragma warning disable 1998
        public async override global::System.Threading.Tasks.Task ExecuteAsync()
        {
#line 1 "E:\Practice\DotNetBook\Walkthrough\Walkthrough-9\WalkthroughNine\WalkthroughNine\Views\Home\Index.cshtml"

            ViewData["Title"] = "Home Page";

#line default
#line hidden
            BeginContext(45, 2, true);
            WriteLiteral("\r\n");
            EndContext();
            BeginContext(120, 2, true);
            WriteLiteral("\r\n");
            EndContext();
            BeginContext(191, 70, true);
            WriteLiteral("\r\n<div>\r\n    <h1>To Do Items</h1>\r\n    <ul>\r\n        <li>Total Items: ");
            EndContext();
            BeginContext(262, 23, false);
#line 14 "E:\Practice\DotNetBook\Walkthrough\Walkthrough-9\WalkthroughNine\WalkthroughNine\Views\Home\Index.cshtml"
            Write(StatsService.GetCount());

#line default
#line hidden
            EndContext();
            BeginContext(285, 30, true);
            WriteLiteral("</li>\r\n        <li>Completed: ");
            EndContext();
            BeginContext(316, 32, false);
#line 15 "E:\Practice\DotNetBook\Walkthrough\Walkthrough-9\WalkthroughNine\WalkthroughNine\Views\Home\Index.cshtml"
            Write(StatsService.GetCompletedCount());

#line default
#line hidden
            EndContext();
            BeginContext(348, 34, true);
            WriteLiteral("</li>\r\n        <li>Avg. Priority: ");
            EndContext();
            BeginContext(383, 33, false);
#line 16 "E:\Practice\DotNetBook\Walkthrough\Walkthrough-9\WalkthroughNine\WalkthroughNine\Views\Home\Index.cshtml"
            Write(StatsService.GetAveragePriority());

#line default
#line hidden
            EndContext();
            BeginContext(416, 149, true);
            WriteLiteral("</li>\r\n    </ul>\r\n    <table>\r\n        <tr>\r\n            <th>Name</th>\r\n            <th>Priority</th>\r\n            <th>Is Done?</th>\r\n        </tr>\r\n");
            EndContext();
#line 24 "E:\Practice\DotNetBook\Walkthrough\Walkthrough-9\WalkthroughNine\WalkthroughNine\Views\Home\Index.cshtml"
            foreach (var item in Model)
            {
#line default
#line hidden
                BeginContext(614, 38, true);
                WriteLiteral("            <tr>\r\n                <td>");
                EndContext();
                BeginContext(653, 9, false);
#line 27 "E:\Practice\DotNetBook\Walkthrough\Walkthrough-9\WalkthroughNine\WalkthroughNine\Views\Home\Index.cshtml"
                Write(item.Name);

#line default
#line hidden
                EndContext();
                BeginContext(662, 27, true);
                WriteLiteral("</td>\r\n                <td>");
                EndContext();
                BeginContext(690, 13, false);
#line 28 "E:\Practice\DotNetBook\Walkthrough\Walkthrough-9\WalkthroughNine\WalkthroughNine\Views\Home\Index.cshtml"
                Write(item.Priority);

#line default
#line hidden
                EndContext();
                BeginContext(703, 27, true);
                WriteLiteral("</td>\r\n                <td>");
                EndContext();
                BeginContext(731, 11, false);
#line 29 "E:\Practice\DotNetBook\Walkthrough\Walkthrough-9\WalkthroughNine\WalkthroughNine\Views\Home\Index.cshtml"
                Write(item.IsDone);

#line default
#line hidden
                EndContext();
                BeginContext(742, 26, true);
                WriteLiteral("</td>\r\n            </tr>\r\n");
                EndContext();
#line 31 "E:\Practice\DotNetBook\Walkthrough\Walkthrough-9\WalkthroughNine\WalkthroughNine\Views\Home\Index.cshtml"
            }

#line default
#line hidden
            BeginContext(779, 22, true);
            WriteLiteral("    </table>\r\n</div>\r\n");
            EndContext();
        }