-
Notifications
You must be signed in to change notification settings - Fork 3
/
ExpiresHeaderValue.cs
30 lines (27 loc) · 986 Bytes
/
ExpiresHeaderValue.cs
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
using System;
namespace Cuemon.AspNetCore.Http.Headers
{
/// <summary>
/// Represents a HTTP Expires header that contains the date/time after which the response is considered stale.
/// </summary>
public class ExpiresHeaderValue
{
private readonly DateTime _expires;
/// <summary>
/// Initializes a new instance of the <see cref="ExpiresHeaderValue"/> class.
/// </summary>
/// <param name="expires">The <see cref="TimeSpan"/> value for when the client-cache expires.</param>
public ExpiresHeaderValue(TimeSpan expires)
{
_expires = DateTime.UtcNow.Add(expires);
}
/// <summary>
/// Returns a <see cref="string" /> that represents this instance.
/// </summary>
/// <returns>A <see cref="string" /> that represents this instance.</returns>
public override string ToString()
{
return _expires.ToString("R");
}
}
}