Mam 4 zajęcia następujące:Jak mogę buforować obiekty i czytać z pamięci, jeśli istnieje zamiast bazy danych?
public class Section
{
public int SectionId { get; set; }
public string Name { get; set; }
public string Title { get; set; }
public string MetaTag { get; set; }
public string MetaDescription { get; set; }
public string UrlSafe { get; set; }
public string Header { get; set; }
public string ImageName { get; set; }
}
public interface ISectionRepository
{
List<Section> GetAllSections();
}
public class SectionRepository : ISectionRepository
{
Context context = new Context();
public List<Section> GetAllSections()
{
return context.Sections.ToList();
}
}
public class SectionApplication
{
SectionRepository sectionRepo = new SectionRepository();
public List<Section> GetAllSections()
{
return sectionRepo.GetAllSections();
}
}
i moim kontroler mam:
public class SectionController : Controller
{
SectionApplication sectionApp = new SectionApplication();
public ActionResult Index()
{
return View(sectionApp.GetAllSections());
}
}
Teraz chcę to zrobić: Chcę chache rozdziały poświęcone pamięci dla określonego czasu w aby odczytać sekcje z pamięci podręcznej, jeśli istnieje, lub odczytać ją z bazy danych.
Który składnik działa z DB? – sll
Spójrz na. http://stackoverflow.com/questions/1276569/caching-in-c-net – Jharis