mirror of
https://gitlab.com/buildfeed/BuildFeed.git
synced 2024-03-22 21:10:34 +08:00
Output caching temporarily disabled
Will need to fix so that it varies by language.
This commit is contained in:
parent
fcf169c868
commit
684bd4f969
|
@ -27,13 +27,13 @@ public frontController() : base()
|
||||||
|
|
||||||
[Route("", Order = 1)]
|
[Route("", Order = 1)]
|
||||||
#if !DEBUG
|
#if !DEBUG
|
||||||
[OutputCache(Duration = 600, VaryByParam = "none", VaryByCustom = "userName")]
|
// [OutputCache(Duration = 600, VaryByParam = "none", VaryByCustom = "userName")]
|
||||||
#endif
|
#endif
|
||||||
public async Task<ActionResult> index() { return await indexPage(1); }
|
public async Task<ActionResult> index() { return await indexPage(1); }
|
||||||
|
|
||||||
[Route("page-{page:int:min(2)}/", Order = 0)]
|
[Route("page-{page:int:min(2)}/", Order = 0)]
|
||||||
#if !DEBUG
|
#if !DEBUG
|
||||||
[OutputCache(Duration = 600, VaryByParam = "page", VaryByCustom = "userName")]
|
// [OutputCache(Duration = 600, VaryByParam = "page", VaryByCustom = "userName")]
|
||||||
#endif
|
#endif
|
||||||
public async Task<ActionResult> indexPage(int page)
|
public async Task<ActionResult> indexPage(int page)
|
||||||
{
|
{
|
||||||
|
@ -54,7 +54,7 @@ public async Task<ActionResult> indexPage(int page)
|
||||||
|
|
||||||
[Route("group/{major}.{minor}.{number}.{revision}/")]
|
[Route("group/{major}.{minor}.{number}.{revision}/")]
|
||||||
#if !DEBUG
|
#if !DEBUG
|
||||||
[OutputCache(Duration = 600, VaryByParam = "none", VaryByCustom = "userName")]
|
// [OutputCache(Duration = 600, VaryByParam = "none", VaryByCustom = "userName")]
|
||||||
#endif
|
#endif
|
||||||
public async Task<ActionResult> viewGroup(byte major, byte minor, ushort number, ushort? revision = null)
|
public async Task<ActionResult> viewGroup(byte major, byte minor, ushort number, ushort? revision = null)
|
||||||
{
|
{
|
||||||
|
@ -73,7 +73,7 @@ public async Task<ActionResult> viewGroup(byte major, byte minor, ushort number,
|
||||||
|
|
||||||
[Route("build/{id:guid}/", Name = "Build")]
|
[Route("build/{id:guid}/", Name = "Build")]
|
||||||
#if !DEBUG
|
#if !DEBUG
|
||||||
[OutputCache(Duration = 600, VaryByParam = "none", VaryByCustom = "userName")]
|
// [OutputCache(Duration = 600, VaryByParam = "none", VaryByCustom = "userName")]
|
||||||
#endif
|
#endif
|
||||||
public async Task<ActionResult> viewBuild(Guid id)
|
public async Task<ActionResult> viewBuild(Guid id)
|
||||||
{
|
{
|
||||||
|
@ -90,7 +90,7 @@ public async Task<ActionResult> viewBuild(long id)
|
||||||
|
|
||||||
[Route("twitter/{id}/")]
|
[Route("twitter/{id}/")]
|
||||||
#if !DEBUG
|
#if !DEBUG
|
||||||
[OutputCache(Duration = 600, VaryByParam = "none")]
|
// [OutputCache(Duration = 600, VaryByParam = "none")]
|
||||||
[CustomContentType(ContentType = "image/png", Order = 2)]
|
[CustomContentType(ContentType = "image/png", Order = 2)]
|
||||||
#endif
|
#endif
|
||||||
public async Task<ActionResult> twitterCard(Guid id)
|
public async Task<ActionResult> twitterCard(Guid id)
|
||||||
|
@ -126,13 +126,13 @@ public async Task<ActionResult> twitterCard(Guid id)
|
||||||
|
|
||||||
[Route("lab/{lab}/", Order = 1, Name = "Lab Root")]
|
[Route("lab/{lab}/", Order = 1, Name = "Lab Root")]
|
||||||
#if !DEBUG
|
#if !DEBUG
|
||||||
[OutputCache(Duration = 600, VaryByParam = "none", VaryByCustom = "userName")]
|
// [OutputCache(Duration = 600, VaryByParam = "none", VaryByCustom = "userName")]
|
||||||
#endif
|
#endif
|
||||||
public async Task<ActionResult> viewLab(string lab) { return await viewLabPage(lab, 1); }
|
public async Task<ActionResult> viewLab(string lab) { return await viewLabPage(lab, 1); }
|
||||||
|
|
||||||
[Route("lab/{lab}/page-{page:int:min(2)}/", Order = 0)]
|
[Route("lab/{lab}/page-{page:int:min(2)}/", Order = 0)]
|
||||||
#if !DEBUG
|
#if !DEBUG
|
||||||
[OutputCache(Duration = 600, VaryByParam = "page", VaryByCustom = "userName")]
|
// [OutputCache(Duration = 600, VaryByParam = "page", VaryByCustom = "userName")]
|
||||||
#endif
|
#endif
|
||||||
public async Task<ActionResult> viewLabPage(string lab, int page)
|
public async Task<ActionResult> viewLabPage(string lab, int page)
|
||||||
{
|
{
|
||||||
|
@ -158,13 +158,13 @@ public async Task<ActionResult> viewLabPage(string lab, int page)
|
||||||
|
|
||||||
[Route("source/{source}/", Order = 1, Name = "Source Root")]
|
[Route("source/{source}/", Order = 1, Name = "Source Root")]
|
||||||
#if !DEBUG
|
#if !DEBUG
|
||||||
[OutputCache(Duration = 600, VaryByParam = "none", VaryByCustom = "userName")]
|
// [OutputCache(Duration = 600, VaryByParam = "none", VaryByCustom = "userName")]
|
||||||
#endif
|
#endif
|
||||||
public async Task<ActionResult> viewSource(TypeOfSource source) { return await viewSourcePage(source, 1); }
|
public async Task<ActionResult> viewSource(TypeOfSource source) { return await viewSourcePage(source, 1); }
|
||||||
|
|
||||||
[Route("source/{source}/page-{page:int:min(2)}/", Order = 0)]
|
[Route("source/{source}/page-{page:int:min(2)}/", Order = 0)]
|
||||||
#if !DEBUG
|
#if !DEBUG
|
||||||
[OutputCache(Duration = 600, VaryByParam = "page", VaryByCustom = "userName")]
|
// [OutputCache(Duration = 600, VaryByParam = "page", VaryByCustom = "userName")]
|
||||||
#endif
|
#endif
|
||||||
public async Task<ActionResult> viewSourcePage(TypeOfSource source, int page)
|
public async Task<ActionResult> viewSourcePage(TypeOfSource source, int page)
|
||||||
{
|
{
|
||||||
|
@ -190,13 +190,13 @@ public async Task<ActionResult> viewSourcePage(TypeOfSource source, int page)
|
||||||
|
|
||||||
[Route("year/{year}/", Order = 1, Name = "Year Root")]
|
[Route("year/{year}/", Order = 1, Name = "Year Root")]
|
||||||
#if !DEBUG
|
#if !DEBUG
|
||||||
[OutputCache(Duration = 600, VaryByParam = "none", VaryByCustom = "userName")]
|
// [OutputCache(Duration = 600, VaryByParam = "none", VaryByCustom = "userName")]
|
||||||
#endif
|
#endif
|
||||||
public async Task<ActionResult> viewYear(int year) { return await viewYearPage(year, 1); }
|
public async Task<ActionResult> viewYear(int year) { return await viewYearPage(year, 1); }
|
||||||
|
|
||||||
[Route("year/{year}/page-{page:int:min(2)}/", Order = 0)]
|
[Route("year/{year}/page-{page:int:min(2)}/", Order = 0)]
|
||||||
#if !DEBUG
|
#if !DEBUG
|
||||||
[OutputCache(Duration = 600, VaryByParam = "page", VaryByCustom = "userName")]
|
// [OutputCache(Duration = 600, VaryByParam = "page", VaryByCustom = "userName")]
|
||||||
#endif
|
#endif
|
||||||
public async Task<ActionResult> viewYearPage(int year, int page)
|
public async Task<ActionResult> viewYearPage(int year, int page)
|
||||||
{
|
{
|
||||||
|
@ -222,13 +222,13 @@ public async Task<ActionResult> viewYearPage(int year, int page)
|
||||||
|
|
||||||
[Route("version/{major}.{minor}/", Order = 1, Name = "Version Root")]
|
[Route("version/{major}.{minor}/", Order = 1, Name = "Version Root")]
|
||||||
#if !DEBUG
|
#if !DEBUG
|
||||||
[OutputCache(Duration = 600, VaryByParam = "none", VaryByCustom = "userName")]
|
// [OutputCache(Duration = 600, VaryByParam = "none", VaryByCustom = "userName")]
|
||||||
#endif
|
#endif
|
||||||
public async Task<ActionResult> viewVersion(int major, int minor) { return await viewVersionPage(major, minor, 1); }
|
public async Task<ActionResult> viewVersion(int major, int minor) { return await viewVersionPage(major, minor, 1); }
|
||||||
|
|
||||||
[Route("version/{major}.{minor}/page-{page:int:min(2)}/", Order = 0)]
|
[Route("version/{major}.{minor}/page-{page:int:min(2)}/", Order = 0)]
|
||||||
#if !DEBUG
|
#if !DEBUG
|
||||||
[OutputCache(Duration = 600, VaryByParam = "none", VaryByCustom = "userName")]
|
// [OutputCache(Duration = 600, VaryByParam = "none", VaryByCustom = "userName")]
|
||||||
#endif
|
#endif
|
||||||
public async Task<ActionResult> viewVersionPage(int major, int minor, int page)
|
public async Task<ActionResult> viewVersionPage(int major, int minor, int page)
|
||||||
{
|
{
|
||||||
|
|
|
@ -143,7 +143,7 @@ public async Task<ActionResult> rss()
|
||||||
|
|
||||||
[Route("sitemap/")]
|
[Route("sitemap/")]
|
||||||
#if !DEBUG
|
#if !DEBUG
|
||||||
[OutputCache(Duration = 3600, VaryByParam = "none", VaryByCustom = "userName")]
|
// [OutputCache(Duration = 3600, VaryByParam = "none", VaryByCustom = "userName")]
|
||||||
#endif
|
#endif
|
||||||
public async Task<ActionResult> sitemap()
|
public async Task<ActionResult> sitemap()
|
||||||
{
|
{
|
||||||
|
@ -288,7 +288,7 @@ group b by b.Lab into lab
|
||||||
|
|
||||||
[Route("xml-sitemap/")]
|
[Route("xml-sitemap/")]
|
||||||
#if !DEBUG
|
#if !DEBUG
|
||||||
[OutputCache(Duration = 3600, VaryByParam = "none", VaryByCustom = "userName")]
|
// [OutputCache(Duration = 3600, VaryByParam = "none", VaryByCustom = "userName")]
|
||||||
#endif
|
#endif
|
||||||
public async Task<ActionResult> xmlsitemap()
|
public async Task<ActionResult> xmlsitemap()
|
||||||
{
|
{
|
||||||
|
@ -326,7 +326,7 @@ public async Task<ActionResult> xmlsitemap()
|
||||||
|
|
||||||
[Route("statistics/")]
|
[Route("statistics/")]
|
||||||
#if !DEBUG
|
#if !DEBUG
|
||||||
[OutputCache(Duration = 3600, VaryByParam = "none", VaryByCustom = "userName")]
|
// [OutputCache(Duration = 3600, VaryByParam = "none", VaryByCustom = "userName")]
|
||||||
#endif
|
#endif
|
||||||
public async Task<ActionResult> stats()
|
public async Task<ActionResult> stats()
|
||||||
{
|
{
|
||||||
|
|
|
@ -6,34 +6,36 @@
|
||||||
|
|
||||||
namespace BuildFeed
|
namespace BuildFeed
|
||||||
{
|
{
|
||||||
public class MvcApplication : System.Web.HttpApplication
|
public class MvcApplication : System.Web.HttpApplication
|
||||||
{
|
{
|
||||||
protected void Application_Start()
|
protected void Application_Start()
|
||||||
{
|
{
|
||||||
// Don't bother looking for the legacy aspx view engine.
|
// Don't bother looking for the legacy aspx view engine.
|
||||||
ViewEngines.Engines.Clear();
|
ViewEngines.Engines.Clear();
|
||||||
ViewEngines.Engines.Add(new RazorViewEngine());
|
ViewEngines.Engines.Add(new RazorViewEngine());
|
||||||
|
|
||||||
AreaRegistration.RegisterAllAreas();
|
AreaRegistration.RegisterAllAreas();
|
||||||
FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
|
FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
|
||||||
RouteConfig.RegisterRoutes(RouteTable.Routes);
|
RouteConfig.RegisterRoutes(RouteTable.Routes);
|
||||||
BundleConfig.RegisterBundles(BundleTable.Bundles);
|
BundleConfig.RegisterBundles(BundleTable.Bundles);
|
||||||
|
|
||||||
DateTimeModelBinder db = new DateTimeModelBinder();
|
DateTimeModelBinder db = new DateTimeModelBinder();
|
||||||
|
|
||||||
ModelBinders.Binders.Add(typeof(DateTime), db);
|
ModelBinders.Binders.Add(typeof(DateTime), db);
|
||||||
ModelBinders.Binders.Add(typeof(DateTime?), db);
|
ModelBinders.Binders.Add(typeof(DateTime?), db);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override string GetVaryByCustomString(HttpContext context, string custom)
|
public override string GetVaryByCustomString(HttpContext context, string custom)
|
||||||
{
|
{
|
||||||
switch(custom)
|
switch (custom)
|
||||||
{
|
{
|
||||||
case "userName":
|
case "userName":
|
||||||
return context.User.Identity.Name.ToLower();
|
return context.User.Identity.Name.ToLower();
|
||||||
}
|
case "lang":
|
||||||
|
return context.Request.Cookies["lang"].Value;
|
||||||
|
}
|
||||||
|
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user