diff options
author | Jesse Plamondon-Willard <Pathoschild@users.noreply.github.com> | 2020-05-23 19:25:34 -0400 |
---|---|---|
committer | Jesse Plamondon-Willard <Pathoschild@users.noreply.github.com> | 2020-05-23 19:25:34 -0400 |
commit | d7add894419543667e60569bfeb439e8e797a4d1 (patch) | |
tree | 0b0b53e6ac306f1549951abe806bded7f9236bd1 /src/SMAPI.Web/Framework/Caching/Cached.cs | |
parent | 9aba50451b617e1af8215358afda22c8105477f2 (diff) | |
download | SMAPI-d7add894419543667e60569bfeb439e8e797a4d1.tar.gz SMAPI-d7add894419543667e60569bfeb439e8e797a4d1.tar.bz2 SMAPI-d7add894419543667e60569bfeb439e8e797a4d1.zip |
drop MongoDB code
MongoDB support unnecessarily complicated the code and there's no need to run distributed servers in the foreseeable future. This keeps the abstract storage interface so we can wrap a distributed cache in the future.
Diffstat (limited to 'src/SMAPI.Web/Framework/Caching/Cached.cs')
-rw-r--r-- | src/SMAPI.Web/Framework/Caching/Cached.cs | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/src/SMAPI.Web/Framework/Caching/Cached.cs b/src/SMAPI.Web/Framework/Caching/Cached.cs new file mode 100644 index 00000000..52041a16 --- /dev/null +++ b/src/SMAPI.Web/Framework/Caching/Cached.cs @@ -0,0 +1,37 @@ +using System; + +namespace StardewModdingAPI.Web.Framework.Caching +{ + /// <summary>A cache entry.</summary> + /// <typeparam name="T">The cached value type.</typeparam> + internal class Cached<T> + { + /********* + ** Accessors + *********/ + /// <summary>The cached data.</summary> + public T Data { get; set; } + + /// <summary>When the data was last updated.</summary> + public DateTimeOffset LastUpdated { get; set; } + + /// <summary>When the data was last requested through the mod API.</summary> + public DateTimeOffset LastRequested { get; set; } + + + /********* + ** Public methods + *********/ + /// <summary>Construct an empty instance.</summary> + public Cached() { } + + /// <summary>Construct an instance.</summary> + /// <param name="data">The cached data.</param> + public Cached(T data) + { + this.Data = data; + this.LastUpdated = DateTimeOffset.UtcNow; + this.LastRequested = DateTimeOffset.UtcNow; + } + } +} |