roadie/RoadieLibrary/Caching/CachePolicy.cs

23 lines
707 B
C#
Raw Normal View History

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