roadie/Roadie.Api.Library/Caching/CachePolicy.cs

20 lines
538 B
C#
Raw Normal View History

2018-11-02 21:04:49 +00:00
using System;
namespace Roadie.Library.Caching
{
public sealed class CachePolicy
{
2019-07-03 16:21:29 +00:00
public TimeSpan ExpiresAfter { get; }
2018-11-04 20:33:37 +00:00
2018-11-02 21:04:49 +00:00
/// <summary>
2019-07-03 16:21:29 +00:00
/// If specified, each read of the item from the cache will reset the expiration time
2018-11-02 21:04:49 +00:00
/// </summary>
2019-07-03 16:21:29 +00:00
public bool RenewLeaseOnAccess { get; }
2018-11-04 20:33:37 +00:00
public CachePolicy(TimeSpan expiresAfter, bool renewLeaseOnAccess = false)
{
2019-07-03 16:21:29 +00:00
ExpiresAfter = expiresAfter;
RenewLeaseOnAccess = renewLeaseOnAccess;
2018-11-04 20:33:37 +00:00
}
2018-11-02 21:04:49 +00:00
}
2018-11-04 20:33:37 +00:00
}