Skip to content

Commit

Permalink
Caching tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
peter-dolkens committed Apr 1, 2016
1 parent 4eda003 commit f8f0a94
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 17 deletions.
8 changes: 4 additions & 4 deletions HoloXPLOR/Controllers/_BaseController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -77,23 +77,23 @@ private void SetCaching(ActionExecutingContext filterContext)
if (rule.IsMatch(filterContext.HttpContext.Request.Url.PathAndQuery))
{
filterContext.HttpContext.Response.Cache.SetCacheability(HttpCacheability.Public);
filterContext.HttpContext.Response.Cache.SetExpires(DateTime.Today.AddDays(7));
filterContext.HttpContext.Response.Cache.SetMaxAge(TimeSpan.FromHours(168));
filterContext.HttpContext.Response.Cache.SetExpires(DateTime.UtcNow.AddMinutes(10));
filterContext.HttpContext.Response.Cache.SetMaxAge(TimeSpan.FromDays(7));
filterContext.HttpContext.Response.DisableKernelCache();

return;
}
}

filterContext.HttpContext.Response.Cache.SetCacheability(HttpCacheability.NoCache);
filterContext.HttpContext.Response.Cache.SetExpires(DateTime.Now);
filterContext.HttpContext.Response.Cache.SetExpires(DateTime.UtcNow);
filterContext.HttpContext.Response.Cache.SetMaxAge(TimeSpan.FromMilliseconds(0));
}

private RedirectResult RedirectTemporary(AuthorizationContext filterContext, String url)
{
filterContext.HttpContext.Response.Cache.SetCacheability(HttpCacheability.NoCache);
filterContext.HttpContext.Response.Cache.SetExpires(DateTime.Now);
filterContext.HttpContext.Response.Cache.SetExpires(DateTime.UtcNow);
filterContext.HttpContext.Response.Cache.SetMaxAge(TimeSpan.FromMilliseconds(0));

return this.Redirect(url);
Expand Down
22 changes: 11 additions & 11 deletions HoloXPLOR/Global.asax.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@ protected void Application_Start()
RouteConfig.RegisterRoutes(RouteTable.Routes);
BundleConfig.RegisterBundles(BundleTable.Bundles);

String lastBuildFile = HostingEnvironment.MapPath("~/App_Data/lastbuild.txt");
if (File.Exists(lastBuildFile))
String latestBuildFile = HostingEnvironment.MapPath("~/App_Data/latestBuild.txt");
if (File.Exists(latestBuildFile))
{
HoloXPLOR_App._scriptsPath = File.ReadAllText(lastBuildFile);
HoloXPLOR_App._scriptsPath = File.ReadAllText(latestBuildFile);
}
ThreadStart ts = new ThreadStart(HoloXPLOR_App.CheckForNewBuild);
new Thread(ts).Start();
Expand All @@ -48,8 +48,10 @@ protected void Application_Start()
private static Boolean _stopping = false;
private static String _launcherInfo = @"http://manifest.robertsspaceindustries.com/Launcher/_LauncherInfo";
private static DateTime _lastRun;
public static Random _random = new Random();
private static Random _random = new Random();

public static String CurrentVersion { get; private set; }
public static Int64 CurrentBuild { get; private set; }
public static Scripts Scripts { get; private set; }

protected void Application_End()
Expand All @@ -69,8 +71,6 @@ public static void CheckForNewBuild()
Int64 publicBuild = 0;

String currentUniverse = String.Empty;
String currentVersion = String.Empty;
Int64 currentBuild = 0;

String latestUniverse = String.Empty;
String latestVersion = String.Empty;
Expand Down Expand Up @@ -109,8 +109,8 @@ public static void CheckForNewBuild()
if (String.Equals(match.Groups[1].Value, universe, StringComparison.InvariantCultureIgnoreCase))
{
currentUniverse = match.Groups[1].Value;
currentVersion = match.Groups[2].Value;
currentBuild = match.Groups[3].Value.ToInt64(0);
HoloXPLOR_App.CurrentVersion = match.Groups[2].Value;
HoloXPLOR_App.CurrentBuild = match.Groups[3].Value.ToInt64(0);
}

if (match.Groups[3].Value.ToInt64() > latestBuild)
Expand All @@ -129,7 +129,7 @@ public static void CheckForNewBuild()
}
}

HoloXPLOR_App.CheckScripts(currentBuild, manifests[currentUniverse]);
HoloXPLOR_App.CheckScripts(HoloXPLOR_App.CurrentBuild, manifests[currentUniverse]);

HoloXPLOR_App.HasPTU = publicBuild < latestBuild;
}
Expand Down Expand Up @@ -248,8 +248,8 @@ public static void CheckScripts(Int64 build, String manifestFile)
scripts.Localization.Count > 0 &&
scripts.Vehicles.Count > 0)
{
String lastBuildFile = HostingEnvironment.MapPath("~/App_Data/lastbuild.txt");
File.WriteAllText(lastBuildFile, HoloXPLOR_App._scriptsPath);
String latestBuildFile = HostingEnvironment.MapPath("~/App_Data/latestBuild.txt");
File.WriteAllText(latestBuildFile, HoloXPLOR_App._scriptsPath);
HoloXPLOR_App.Scripts = scripts;
}
}
Expand Down
2 changes: 1 addition & 1 deletion HoloXPLOR/Views/Home/Index.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
}

<div class="jumbotron js-upload-inventory">
<h1>HoloXPLOR - 2.3.0</h1>
<h1>HoloXPLOR - @(HoloXPLOR_App.CurrentVersion) <small>@HoloXPLOR_App.CurrentBuild</small></h1>
<div class="row">
<div class="col-md-6 col-sm-12">
<p class="lead">HoloXPLOR is your web-based alternative to the Star Citizen Holotable.</p>
Expand Down
2 changes: 1 addition & 1 deletion HoloXPLOR/Views/Shared/_Layout.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@
<input type="hidden" name="hosted_button_id" value="CA3VSDP39JT4G">

<p class="pull-left">
&copy; @DateTime.Now.Year - HoloXPLOR
&copy; @DateTime.Now.Year - HoloXPLOR - @(HoloXPLOR_App.CurrentVersion) <small>@HoloXPLOR_App.CurrentBuild
</p>
<p class="pull-right">
@*
Expand Down

0 comments on commit f8f0a94

Please sign in to comment.