Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

#2: Changed series info cache to expire in 7days from tvdb.com.

  • Loading branch information...
commit 09551c17cd5bf938c05012af31531480e9101139 1 parent 9b0b1c4
Damien Haynes authored
Showing with 5 additions and 5 deletions.
  1. +1 −1  Sites/API/TVDb/TVDbAPI.cs
  2. +4 −4 Sites/API/TVDb/TVDbCache.cs
2  Sites/API/TVDb/TVDbAPI.cs
View
@@ -46,7 +46,7 @@ public static TVDbEpisodeRatings GetEpisodeRatings(string accountId, string seri
public static TVDbShow GetShowInfo(string seriesId)
{
string fileCache = string.Format(TVDbCache.cShowInfoFileCache, seriesId);
- string response = TVDbCache.GetFromCache(fileCache, false);
+ string response = TVDbCache.GetFromCache(fileCache, 7);
if (string.IsNullOrEmpty(response))
{
response = TraktWeb.Transmit(string.Format(TVDbURIs.SeriesInfo, seriesId), string.Empty);
8 Sites/API/TVDb/TVDbCache.cs
View
@@ -16,16 +16,16 @@ public static class TVDbCache
public static string GetFromCache(string filename)
{
- return GetFromCache(filename, true);
+ return GetFromCache(filename, 1);
}
- public static string GetFromCache(string filename, bool expires)
+ public static string GetFromCache(string filename, int expiresInDays)
{
try
{
if (!File.Exists(filename)) return null;
- // if cache is older than 1 day disregard
- if (expires && File.GetLastWriteTime(filename) <= DateTime.Now.Subtract(TimeSpan.FromDays(1)))
+ // if cache is older than X days disregard
+ if (File.GetLastWriteTime(filename) <= DateTime.Now.Subtract(TimeSpan.FromDays(expiresInDays)))
return null;
return File.ReadAllText(filename);
Please sign in to comment.
Something went wrong with that request. Please try again.