#

Memo ASP Core Trick:

 

Notiz für später

Server Cache in Asp Core Server nutzen

 

Folgendes Attribut kann man beim Asp API und MVC Controller Anfragen vor einen Endpoint / Methode setzen

[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]

..

 

Dadurch wird die Abfrage von Ergebnissen wesentlich beschleunigt

 

 

 

 

Gilt für

Asp Core .Net 5 MVC

 

 

using Microsoft.AspNetCore.Mvc;

using Microsoft.Extensions.Logging;

using Readdy.Models;

using System;

using System.Collections.Generic;

using System.Diagnostics;

using System.Linq;

using System.Threading.Tasks;

 

namespace Readdy.Controllers

{

    public class HomeController : Controller

    {

        private readonly ILogger<HomeController> _logger;

 

        public HomeController(ILogger<HomeController> logger)

        {

            _logger = logger;

        }

 

        public IActionResult Index()

        {

            return View();

        }

 

        public IActionResult Privacy()

        {

            return View();

        }

 

        [ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]

        public IActionResult Error()

        {

            return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier });

        }

    }

}

 

 

Mobile

.

0123movie.net