diff options
author | Jesse Plamondon-Willard <Pathoschild@users.noreply.github.com> | 2019-07-24 18:31:43 -0400 |
---|---|---|
committer | Jesse Plamondon-Willard <Pathoschild@users.noreply.github.com> | 2019-09-14 18:58:49 -0400 |
commit | 03a082297a750dace586dc2d15d17c840d96d95f (patch) | |
tree | 2c18c9e428b8e841b75b130dd272989991124668 /src/SMAPI.Web/Framework | |
parent | f6b336def7b05c3ef202f6c6b5e77dcaa0c498fa (diff) | |
download | SMAPI-03a082297a750dace586dc2d15d17c840d96d95f.tar.gz SMAPI-03a082297a750dace586dc2d15d17c840d96d95f.tar.bz2 SMAPI-03a082297a750dace586dc2d15d17c840d96d95f.zip |
add generic cache repository interface (#651)
Diffstat (limited to 'src/SMAPI.Web/Framework')
4 files changed, 17 insertions, 9 deletions
diff --git a/src/SMAPI.Web/Framework/Caching/ICacheRepository.cs b/src/SMAPI.Web/Framework/Caching/ICacheRepository.cs new file mode 100644 index 00000000..5de7e731 --- /dev/null +++ b/src/SMAPI.Web/Framework/Caching/ICacheRepository.cs @@ -0,0 +1,13 @@ +using System; + +namespace StardewModdingAPI.Web.Framework.Caching +{ + /// <summary>Encapsulates logic for accessing data in the cache.</summary> + internal interface ICacheRepository + { + /// <summary>Whether cached data is stale.</summary> + /// <param name="lastUpdated">The date when the data was updated.</param> + /// <param name="staleMinutes">The age in minutes before data is considered stale.</param> + bool IsStale(DateTimeOffset lastUpdated, int staleMinutes); + } +} diff --git a/src/SMAPI.Web/Framework/Caching/Wiki/CachedWikiMetadata.cs b/src/SMAPI.Web/Framework/Caching/Wiki/CachedWikiMetadata.cs index 4d6b4b10..6a560eb4 100644 --- a/src/SMAPI.Web/Framework/Caching/Wiki/CachedWikiMetadata.cs +++ b/src/SMAPI.Web/Framework/Caching/Wiki/CachedWikiMetadata.cs @@ -5,7 +5,7 @@ using MongoDB.Bson; namespace StardewModdingAPI.Web.Framework.Caching.Wiki { /// <summary>The model for cached wiki metadata.</summary> - public class CachedWikiMetadata + internal class CachedWikiMetadata { /********* ** Accessors diff --git a/src/SMAPI.Web/Framework/Caching/Wiki/CachedWikiMod.cs b/src/SMAPI.Web/Framework/Caching/Wiki/CachedWikiMod.cs index bf1e2be2..37f55db1 100644 --- a/src/SMAPI.Web/Framework/Caching/Wiki/CachedWikiMod.cs +++ b/src/SMAPI.Web/Framework/Caching/Wiki/CachedWikiMod.cs @@ -7,7 +7,7 @@ using StardewModdingAPI.Toolkit.Framework.Clients.Wiki; namespace StardewModdingAPI.Web.Framework.Caching.Wiki { /// <summary>The model for cached wiki mods.</summary> - public class CachedWikiMod + internal class CachedWikiMod { /********* ** Accessors diff --git a/src/SMAPI.Web/Framework/Caching/Wiki/IWikiCacheRepository.cs b/src/SMAPI.Web/Framework/Caching/Wiki/IWikiCacheRepository.cs index 6031123d..b54c8a2f 100644 --- a/src/SMAPI.Web/Framework/Caching/Wiki/IWikiCacheRepository.cs +++ b/src/SMAPI.Web/Framework/Caching/Wiki/IWikiCacheRepository.cs @@ -5,8 +5,8 @@ using StardewModdingAPI.Toolkit.Framework.Clients.Wiki; namespace StardewModdingAPI.Web.Framework.Caching.Wiki { - /// <summary>Encapsulates logic for accessing the mod data cache.</summary> - internal interface IWikiCacheRepository + /// <summary>Encapsulates logic for accessing the wiki data cache.</summary> + internal interface IWikiCacheRepository : ICacheRepository { /********* ** Methods @@ -15,11 +15,6 @@ namespace StardewModdingAPI.Web.Framework.Caching.Wiki /// <param name="metadata">The fetched metadata.</param> bool TryGetWikiMetadata(out CachedWikiMetadata metadata); - /// <summary>Whether cached data is stale.</summary> - /// <param name="lastUpdated">The date when the data was updated.</param> - /// <param name="staleMinutes">The age in minutes before data is considered stale.</param> - bool IsStale(DateTimeOffset lastUpdated, int staleMinutes); - /// <summary>Get the cached wiki mods.</summary> /// <param name="filter">A filter to apply, if any.</param> IEnumerable<CachedWikiMod> GetWikiMods(Expression<Func<CachedWikiMod, bool>> filter = null); |