-
-
Notifications
You must be signed in to change notification settings - Fork 272
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b2c2a1c
commit 3793d2e
Showing
10 changed files
with
183 additions
and
120 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
src/SMAPI.Web/Framework/Caching/BaseExportCacheRepository.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
using System; | ||
|
||
namespace StardewModdingAPI.Web.Framework.Caching | ||
{ | ||
/// <summary>The base logic for an export cache repository.</summary> | ||
internal abstract class BaseExportCacheRepository : BaseCacheRepository, IExportCacheRepository | ||
{ | ||
/********* | ||
** Public methods | ||
*********/ | ||
/// <inheritdoc /> | ||
public abstract bool IsLoaded(); | ||
|
||
/// <inheritdoc /> | ||
public abstract DateTimeOffset GetLastModified(); | ||
|
||
/// <inheritdoc /> | ||
public bool IsStale(int staleMinutes) | ||
{ | ||
return this.IsStale(this.GetLastModified(), staleMinutes); | ||
} | ||
|
||
/// <inheritdoc /> | ||
public abstract void Clear(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
using System; | ||
|
||
namespace StardewModdingAPI.Web.Framework.Caching | ||
{ | ||
/// <summary>Encapsulates logic for accessing data in a cached mod export from a remote API.</summary> | ||
internal interface IExportCacheRepository : ICacheRepository | ||
{ | ||
/********* | ||
** Methods | ||
*********/ | ||
/// <summary>Get whether the export data is currently available.</summary> | ||
bool IsLoaded(); | ||
|
||
/// <summary>Get the date when the cached data was last modified.</summary> | ||
DateTimeOffset GetLastModified(); | ||
|
||
/// <summary>Get whether the cached data is stale.</summary> | ||
/// <param name="staleMinutes">The age in minutes before data is considered stale.</param> | ||
bool IsStale(int staleMinutes); | ||
|
||
/// <summary>Clear all data in the cache.</summary> | ||
void Clear(); | ||
} | ||
} |
Oops, something went wrong.