blob: 904455c5c17c7073738843a0032b8b9505e38e91 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
using System;
namespace StardewModdingAPI.Web.Framework.Caching
{
/// <summary>The base logic for a cache repository.</summary>
internal abstract class BaseCacheRepository
{
/*********
** Public methods
*********/
/// <summary>Whether cached data is stale.</summary>
/// <param name="lastUpdated">The date when the data was updated.</param>
/// <param name="cacheMinutes">The age in minutes before data is considered stale.</param>
public bool IsStale(DateTimeOffset lastUpdated, int cacheMinutes)
{
return lastUpdated < DateTimeOffset.UtcNow.AddMinutes(-cacheMinutes);
}
}
}
|