Add output caching to the Delivery API (#15216)
This commit is contained in:
@@ -59,6 +59,11 @@ public class DeliveryApiSettings
|
||||
/// </summary>
|
||||
public MemberAuthorizationSettings? MemberAuthorization { get; set; } = null;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the settings for the Delivery API output cache.
|
||||
/// </summary>
|
||||
public OutputCacheSettings OutputCache { get; set; } = new ();
|
||||
|
||||
/// <summary>
|
||||
/// Gets a value indicating if any member authorization type is enabled for the Delivery API.
|
||||
/// </summary>
|
||||
@@ -138,4 +143,42 @@ public class DeliveryApiSettings
|
||||
/// <remarks>These are only required if logout is to be used.</remarks>
|
||||
public Uri[] LogoutRedirectUrls { get; set; } = Array.Empty<Uri>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Typed configuration options for output caching of the Delivery API.
|
||||
/// </summary>
|
||||
public class OutputCacheSettings
|
||||
{
|
||||
private const string StaticDuration = "00:01:00"; // one minute
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether the Delivery API output should be cached.
|
||||
/// </summary>
|
||||
/// <value><c>true</c> if the Delivery API output should be cached; otherwise, <c>false</c>.</value>
|
||||
/// <remarks>
|
||||
/// The default value is <c>false</c>.
|
||||
/// </remarks>
|
||||
[DefaultValue(StaticEnabled)]
|
||||
public bool Enabled { get; set; } = StaticEnabled;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating how long the Content Delivery API output should be cached.
|
||||
/// </summary>
|
||||
/// <value>Cache lifetime.</value>
|
||||
/// <remarks>
|
||||
/// The default cache duration is one minute, if this configuration value is not provided.
|
||||
/// </remarks>
|
||||
[DefaultValue(StaticDuration)]
|
||||
public TimeSpan ContentDuration { get; set; } = TimeSpan.Parse(StaticDuration);
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating how long the Media Delivery API output should be cached.
|
||||
/// </summary>
|
||||
/// <value>Cache lifetime.</value>
|
||||
/// <remarks>
|
||||
/// The default cache duration is one minute, if this configuration value is not provided.
|
||||
/// </remarks>
|
||||
[DefaultValue(StaticDuration)]
|
||||
public TimeSpan MediaDuration { get; set; } = TimeSpan.Parse(StaticDuration);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user