Skip to content

Commit

Permalink
Merge pull request #162 from vp89/removestale0default
Browse files Browse the repository at this point in the history
StaleAfter no longer defaults to 0 when unspecified
  • Loading branch information
Turnerj authored Apr 20, 2021
2 parents 1ac19fe + 97d2dc4 commit 03efb4c
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions src/CacheTower/CacheSettings.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using System;
using System.Collections.Generic;
using System.Text;

namespace CacheTower
{
Expand All @@ -21,18 +19,14 @@ public struct CacheSettings
/// <summary>
/// Configures the cache entry to have a life of <paramref name="timeToLive"/>.
/// </summary>
/// <remarks>
/// As no stale time has been configured, the cache entry is always considered stale and will always perform a background refresh.
/// In most cases it is recommended to use <see cref="CacheSettings(TimeSpan, TimeSpan)"/> and set an appropriate stale after time.
/// </remarks>
/// <param name="timeToLive">
/// How long till a cache entry is considered expired.
/// Expired entries are removed from the cache and will force a foreground refresh if there is a cache miss.
/// </param>
public CacheSettings(TimeSpan timeToLive)
{
TimeToLive = timeToLive;
StaleAfter = TimeSpan.Zero;
StaleAfter = timeToLive;
}

/// <summary>
Expand All @@ -48,7 +42,7 @@ public CacheSettings(TimeSpan timeToLive)
/// <para>
/// Setting this too low will cause potentially unnecessary background refreshes.
/// Setting this too high may limit the usefulness of a stale time.
/// You will need to decide on the appropraite value based on your own usage.
/// You will need to decide on the appropriate value based on your own usage.
/// </para>
/// </param>
public CacheSettings(TimeSpan timeToLive, TimeSpan staleAfter)
Expand Down

0 comments on commit 03efb4c

Please sign in to comment.