blob: 52041a16cd0998206ff83474126c22d6e3a139b6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
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;
}
}
}
|