Permalink
Browse files

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

  • Loading branch information...
1 parent 9b0b1c4 commit 09551c17cd5bf938c05012af31531480e9101139 @damienhaynes committed Apr 27, 2012
Showing with 5 additions and 5 deletions.
  1. +1 −1 Sites/API/TVDb/TVDbAPI.cs
  2. +4 −4 Sites/API/TVDb/TVDbCache.cs
View
2 Sites/API/TVDb/TVDbAPI.cs
@@ -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);
View
8 Sites/API/TVDb/TVDbCache.cs
@@ -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);

0 comments on commit 09551c1

Please sign in to comment.