2020-12-06 10:46:04 +01:00
|
|
|
// Copyright (c) Umbraco.
|
|
|
|
|
// See LICENSE for more details.
|
|
|
|
|
|
|
|
|
|
using System;
|
2021-07-05 14:27:49 +01:00
|
|
|
using System.ComponentModel;
|
2020-09-23 14:00:08 +02:00
|
|
|
using System.IO;
|
2020-09-14 21:27:31 +02:00
|
|
|
|
2021-02-18 11:06:02 +01:00
|
|
|
namespace Umbraco.Cms.Core.Configuration.Models
|
2020-08-20 08:24:23 +01:00
|
|
|
{
|
2020-12-06 10:46:04 +01:00
|
|
|
/// <summary>
|
|
|
|
|
/// Typed configuration options for image cache settings.
|
|
|
|
|
/// </summary>
|
2020-08-20 08:24:23 +01:00
|
|
|
public class ImagingCacheSettings
|
|
|
|
|
{
|
2021-08-18 10:01:33 +02:00
|
|
|
internal const string StaticBrowserMaxAge = "7.00:00:00";
|
|
|
|
|
internal const string StaticCacheMaxAge = "365.00:00:00";
|
2021-07-05 14:27:49 +01:00
|
|
|
internal const int StaticCachedNameLength = 8;
|
2021-08-18 10:01:33 +02:00
|
|
|
internal const string StaticCacheFolder = Constants.SystemDirectories.TempData + "/MediaCache";
|
2021-07-05 14:27:49 +01:00
|
|
|
|
2020-12-06 10:46:04 +01:00
|
|
|
/// <summary>
|
|
|
|
|
/// Gets or sets a value for the browser image cache maximum age.
|
|
|
|
|
/// </summary>
|
2021-07-05 14:27:49 +01:00
|
|
|
[DefaultValue(StaticBrowserMaxAge)]
|
|
|
|
|
public TimeSpan BrowserMaxAge { get; set; } = TimeSpan.Parse(StaticBrowserMaxAge);
|
2020-08-20 08:24:23 +01:00
|
|
|
|
2020-12-06 10:46:04 +01:00
|
|
|
/// <summary>
|
|
|
|
|
/// Gets or sets a value for the image cache maximum age.
|
|
|
|
|
/// </summary>
|
2021-07-05 14:27:49 +01:00
|
|
|
[DefaultValue(StaticCacheMaxAge)]
|
|
|
|
|
public TimeSpan CacheMaxAge { get; set; } = TimeSpan.Parse(StaticCacheMaxAge);
|
2020-08-20 08:24:23 +01:00
|
|
|
|
2020-12-06 10:46:04 +01:00
|
|
|
/// <summary>
|
|
|
|
|
/// Gets or sets a value for length of the cached name.
|
|
|
|
|
/// </summary>
|
2021-07-05 14:27:49 +01:00
|
|
|
[DefaultValue(StaticCachedNameLength)]
|
|
|
|
|
public uint CachedNameLength { get; set; } = StaticCachedNameLength;
|
2020-08-20 08:24:23 +01:00
|
|
|
|
2020-12-06 10:46:04 +01:00
|
|
|
/// <summary>
|
|
|
|
|
/// Gets or sets a value for the cache folder.
|
|
|
|
|
/// </summary>
|
2021-07-05 14:27:49 +01:00
|
|
|
[DefaultValue(StaticCacheFolder)]
|
|
|
|
|
public string CacheFolder { get; set; } = StaticCacheFolder;
|
2020-08-20 08:24:23 +01:00
|
|
|
}
|
|
|
|
|
}
|