Skip to content

Commit

Permalink
More doc comment additions
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanbrandenburg committed Jul 8, 2019
1 parent d3cad4c commit 551e7c2
Show file tree
Hide file tree
Showing 36 changed files with 144 additions and 101 deletions.
50 changes: 30 additions & 20 deletions src/Caching/Abstractions/src/CacheEntryExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@ public static class CacheEntryExtensions
/// <summary>
/// Sets the priority for keeping the cache entry in the cache during a memory pressure tokened cleanup.
/// </summary>
/// <param name="entry"></param>
/// <param name="priority"></param>
/// <param name="entry">The entry to set the priority for.</param>
/// <param name="priority">The <see cref="CacheItemPriority"/> to set on the entry.</param>
/// <returns>The <see cref="ICacheEntry"/> for chaining.</returns>
public static ICacheEntry SetPriority(
this ICacheEntry entry,
CacheItemPriority priority)
Expand All @@ -26,6 +27,7 @@ public static ICacheEntry SetPriority(
/// </summary>
/// <param name="entry">The <see cref="ICacheEntry"/>.</param>
/// <param name="expirationToken">The <see cref="IChangeToken"/> that causes the cache entry to expire.</param>
/// <returns>The <see cref="ICacheEntry"/> for chaining.</returns>
public static ICacheEntry AddExpirationToken(
this ICacheEntry entry,
IChangeToken expirationToken)
Expand All @@ -42,8 +44,9 @@ public static ICacheEntry AddExpirationToken(
/// <summary>
/// Sets an absolute expiration time, relative to now.
/// </summary>
/// <param name="entry"></param>
/// <param name="relative"></param>
/// <param name="entry">The <see cref="ICacheEntry"/>.</param>
/// <param name="relative">The <see cref="TimeSpan"/> representing the expiration time relative to now.</param>
/// <returns>The <see cref="ICacheEntry"/> for chaining.</returns>
public static ICacheEntry SetAbsoluteExpiration(
this ICacheEntry entry,
TimeSpan relative)
Expand All @@ -55,8 +58,9 @@ public static ICacheEntry SetAbsoluteExpiration(
/// <summary>
/// Sets an absolute expiration date for the cache entry.
/// </summary>
/// <param name="entry"></param>
/// <param name="absolute"></param>
/// <param name="entry">The <see cref="ICacheEntry"/>.</param>
/// <param name="absolute">A <see cref="DateTimeOffset"/> representing the expiration time in absolute terms.</param>
/// <returns>The <see cref="ICacheEntry"/> for chaining.</returns>
public static ICacheEntry SetAbsoluteExpiration(
this ICacheEntry entry,
DateTimeOffset absolute)
Expand All @@ -69,8 +73,9 @@ public static ICacheEntry SetAbsoluteExpiration(
/// Sets how long the cache entry can be inactive (e.g. not accessed) before it will be removed.
/// This will not extend the entry lifetime beyond the absolute expiration (if set).
/// </summary>
/// <param name="entry"></param>
/// <param name="offset"></param>
/// <param name="entry">The <see cref="ICacheEntry"/>.</param>
/// <param name="offset">A <see cref="TimeSpan"/> representing a sliding expiration.</param>
/// <returns>The <see cref="ICacheEntry"/> for chaining.</returns>
public static ICacheEntry SetSlidingExpiration(
this ICacheEntry entry,
TimeSpan offset)
Expand All @@ -82,8 +87,9 @@ public static ICacheEntry SetSlidingExpiration(
/// <summary>
/// The given callback will be fired after the cache entry is evicted from the cache.
/// </summary>
/// <param name="entry"></param>
/// <param name="callback"></param>
/// <param name="entry">The <see cref="ICacheEntry"/>.</param>
/// <param name="callback">The callback to run after the entry is evicted.</param>
/// <returns>The <see cref="ICacheEntry"/> for chaining.</returns>
public static ICacheEntry RegisterPostEvictionCallback(
this ICacheEntry entry,
PostEvictionDelegate callback)
Expand All @@ -99,9 +105,10 @@ public static ICacheEntry RegisterPostEvictionCallback(
/// <summary>
/// The given callback will be fired after the cache entry is evicted from the cache.
/// </summary>
/// <param name="entry"></param>
/// <param name="callback"></param>
/// <param name="state"></param>
/// <param name="entry">The <see cref="ICacheEntry"/>.</param>
/// <param name="callback">The callback to run after the entry is evicted.</param>
/// <param name="state">The state to pass to the post-eviction callback.</param>
/// <returns>The <see cref="ICacheEntry"/> for chaining.</returns>
public static ICacheEntry RegisterPostEvictionCallback(
this ICacheEntry entry,
PostEvictionDelegate callback,
Expand All @@ -123,8 +130,9 @@ public static ICacheEntry RegisterPostEvictionCallback(
/// <summary>
/// Sets the value of the cache entry.
/// </summary>
/// <param name="entry"></param>
/// <param name="value"></param>
/// <param name="entry">The <see cref="ICacheEntry"/>.</param>
/// <param name="value">The value to set on the <paramref name="entry"/>.</param>
/// <returns>The <see cref="ICacheEntry"/> for chaining.</returns>
public static ICacheEntry SetValue(
this ICacheEntry entry,
object value)
Expand All @@ -136,8 +144,9 @@ public static ICacheEntry SetValue(
/// <summary>
/// Sets the size of the cache entry value.
/// </summary>
/// <param name="entry"></param>
/// <param name="size"></param>
/// <param name="entry">The <see cref="ICacheEntry"/>.</param>
/// <param name="size">The size to set on the <paramref name="entry"/>.</param>
/// <returns>The <see cref="ICacheEntry"/> for chaining.</returns>
public static ICacheEntry SetSize(
this ICacheEntry entry,
long size)
Expand All @@ -154,8 +163,9 @@ public static ICacheEntry SetSize(
/// <summary>
/// Applies the values of an existing <see cref="MemoryCacheEntryOptions"/> to the entry.
/// </summary>
/// <param name="entry"></param>
/// <param name="options"></param>
/// <param name="entry">The <see cref="ICacheEntry"/>.</param>
/// <param name="options">Set the values of these options on the <paramref name="entry"/>.</param>
/// <returns>The <see cref="ICacheEntry"/> for chaining.</returns>
public static ICacheEntry SetOptions(this ICacheEntry entry, MemoryCacheEntryOptions options)
{
if (options == null)
Expand All @@ -182,4 +192,4 @@ public static ICacheEntry SetOptions(this ICacheEntry entry, MemoryCacheEntryOpt
return entry;
}
}
}
}
12 changes: 6 additions & 6 deletions src/Caching/Abstractions/src/DistributedCacheEntryExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ public static class DistributedCacheEntryExtensions
/// <summary>
/// Sets an absolute expiration time, relative to now.
/// </summary>
/// <param name="options"></param>
/// <param name="relative"></param>
/// <param name="options">The options to be operated on.</param>
/// <param name="relative">The expiration time, relative to now.</param>
public static DistributedCacheEntryOptions SetAbsoluteExpiration(
this DistributedCacheEntryOptions options,
TimeSpan relative)
Expand All @@ -23,8 +23,8 @@ public static DistributedCacheEntryOptions SetAbsoluteExpiration(
/// <summary>
/// Sets an absolute expiration date for the cache entry.
/// </summary>
/// <param name="options"></param>
/// <param name="absolute"></param>
/// <param name="options">The options to be operated on.</param>
/// <param name="absolute">The expiration time, in absolute terms.</param>
public static DistributedCacheEntryOptions SetAbsoluteExpiration(
this DistributedCacheEntryOptions options,
DateTimeOffset absolute)
Expand All @@ -37,8 +37,8 @@ public static DistributedCacheEntryOptions SetAbsoluteExpiration(
/// Sets how long the cache entry can be inactive (e.g. not accessed) before it will be removed.
/// This will not extend the entry lifetime beyond the absolute expiration (if set).
/// </summary>
/// <param name="options"></param>
/// <param name="offset"></param>
/// <param name="options">The options to be operated on.</param>
/// <param name="offset">The sliding expiration time.</param>
public static DistributedCacheEntryOptions SetSlidingExpiration(
this DistributedCacheEntryOptions options,
TimeSpan offset)
Expand Down
2 changes: 1 addition & 1 deletion src/Caching/Abstractions/src/MemoryCacheEntryExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public static MemoryCacheEntryOptions SetPriority(
/// <summary>
/// Sets the size of the cache entry value.
/// </summary>
/// <param name="options">The option to set the size of.</param>
/// <param name="options">The options to set the entry size on.</param>
/// <param name="size">The size to set on the <see cref="MemoryCacheEntryOptions"/>.</param>
/// <returns>The <see cref="MemoryCacheEntryOptions"/> so that additional calls can be chained.</returns>
public static MemoryCacheEntryOptions SetSize(
Expand Down
6 changes: 3 additions & 3 deletions src/Caching/Abstractions/src/PostEvictionDelegate.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ namespace Microsoft.Extensions.Caching.Memory
/// <summary>
/// Signature of the callback which gets called when a cache entry expires.
/// </summary>
/// <param name="key"></param>
/// <param name="value"></param>
/// <param name="key">The key of the entry being evicted.</param>
/// <param name="value">The value of the entry being evicted.</param>
/// <param name="reason">The <see cref="EvictionReason"/>.</param>
/// <param name="state">The information that was passed when registering the callback.</param>
public delegate void PostEvictionDelegate(object key, object value, EvictionReason reason, object state);
}
}
2 changes: 1 addition & 1 deletion src/Caching/Memory/test/TokenExpirationTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -249,4 +249,4 @@ public void Dispose()
}
}
}
}
}
2 changes: 1 addition & 1 deletion src/Caching/samples/RedisCacheSample/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public static void Main(string[] args)
/// Install this chocolatey package: http://chocolatey.org/packages/redis-64/
/// run "redis-server" from command prompt.
/// </summary>
/// <param name="args"></param>
/// <returns>The <see cref="Task"/> that represents the asynchronous operation.</returns>
public static async Task RunSampleAsync()
{
var key = "myKey";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public static class ConfigurationExtensions
/// </summary>
/// <param name="configuration">The configuration.</param>
/// <param name="name">The connection string key.</param>
/// <returns></returns>
/// <returns>The connection string.</returns>
public static string GetConnectionString(this IConfiguration configuration, string name)
{
return configuration?.GetSection("ConnectionStrings")?[name];
Expand Down Expand Up @@ -71,7 +71,7 @@ public static IEnumerable<KeyValuePair<string, string>> AsEnumerable(this IConfi
}

/// <summary>
/// Determines whether the section has a <see cref="IConfigurationSection.Value"/> or has children
/// Determines whether the section has a <see cref="IConfigurationSection.Value"/> or has children
/// </summary>
public static bool Exists(this IConfigurationSection section)
{
Expand All @@ -82,4 +82,4 @@ public static bool Exists(this IConfigurationSection section)
return section.Value != null || section.GetChildren().Any();
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public interface IConfigurationProvider
/// <summary>
/// Returns a change token if this provider supports change tracking, null otherwise.
/// </summary>
/// <returns></returns>
/// <returns>The change token.</returns>
IChangeToken GetReloadToken();

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ internal class AzureKeyVaultConfigurationProvider : ConfigurationProvider, IDisp
/// </summary>
/// <param name="client">The <see cref="KeyVaultClient"/> to use for retrieving values.</param>
/// <param name="vault">Azure KeyVault uri.</param>
/// <param name="manager"></param>
/// <param name="manager">The <see cref="IKeyVaultSecretManager"/> to use in managing values.</param>
/// <param name="reloadInterval">The timespan to wait in between each attempt at polling the Azure KeyVault for changes. Default is null which indicates no reloading.</param>
public AzureKeyVaultConfigurationProvider(IKeyVaultClient client, string vault, IKeyVaultSecretManager manager, TimeSpan? reloadInterval = null)
{
Expand All @@ -38,14 +38,17 @@ public AzureKeyVaultConfigurationProvider(IKeyVaultClient client, string vault,
_manager = manager ?? throw new ArgumentNullException(nameof(manager));
if (reloadInterval != null && reloadInterval.Value <= TimeSpan.Zero)
{
throw new ArgumentOutOfRangeException (nameof(reloadInterval), reloadInterval, nameof(reloadInterval) + " must be positive.");
throw new ArgumentOutOfRangeException(nameof(reloadInterval), reloadInterval, nameof(reloadInterval) + " must be positive.");
}

_pollingTask = null;
_cancellationToken = new CancellationTokenSource();
_reloadInterval = reloadInterval;
}

/// <summary>
/// Load secrets into this provider.
/// </summary>
public override void Load() => LoadAsync().ConfigureAwait(false).GetAwaiter().GetResult();

private async Task PollForSecretChangesAsync()
Expand Down Expand Up @@ -145,6 +148,7 @@ private void SetData(Dictionary<string, LoadedSecret> loadedSecrets, bool fireTo
}
}

/// <inheritdoc/>
public void Dispose()
{
_cancellationToken.Cancel();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public IniStreamConfigurationProvider(IniStreamConfigurationSource source) : bas
/// Read a stream of INI values into a key/value dictionary.
/// </summary>
/// <param name="stream">The stream of INI data.</param>
/// <returns></returns>
/// <returns>The <see cref="IDictionary{String, String}"/> which was read from the stream.</returns>
public static IDictionary<string, string> Read(Stream stream)
{
var data = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
Expand All @@ -45,7 +45,7 @@ public static IDictionary<string, string> Read(Stream stream)
{
continue;
}
// [Section:header]
// [Section:header]
if (line[0] == '[' && line[line.Length - 1] == ']')
{
// remove the brackets
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public class NewtonsoftJsonStreamConfigurationProvider : StreamConfigurationProv
/// <summary>
/// Constructor.
/// </summary>
/// <param name="source"></param>
/// <param name="source">The source of configuration.</param>
public NewtonsoftJsonStreamConfigurationProvider(NewtonsoftJsonStreamConfigurationSource source) : base(source) { }

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public XmlStreamConfigurationProvider(XmlStreamConfigurationSource source) : bas
/// </summary>
/// <param name="stream">The stream of INI data.</param>
/// <param name="decryptor">The <see cref="XmlDocumentDecryptor"/> to use to decrypt.</param>
/// <returns></returns>
/// <returns>The <see cref="IDictionary{String, String}"/> which was read from the stream.</returns>
public static IDictionary<string, string> Read(Stream stream, XmlDocumentDecryptor decryptor)
{
var data = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
Expand All @@ -46,7 +46,7 @@ public static IDictionary<string, string> Read(Stream stream, XmlDocumentDecrypt

SkipUntilRootElement(reader);

// We process the root element individually since it doesn't contribute to prefix
// We process the root element individually since it doesn't contribute to prefix
ProcessAttributes(reader, prefixStack, data, AddNamePrefix);
ProcessAttributes(reader, prefixStack, data, AddAttributePair);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public bool TryGet(string key, out string value)
/// <summary>
/// Returns a change token if this provider supports change tracking, null otherwise.
/// </summary>
/// <returns></returns>
/// <returns>The change token.</returns>
public IChangeToken GetReloadToken() => _config.GetReloadToken();

/// <summary>
Expand Down
6 changes: 3 additions & 3 deletions src/Configuration/Config/src/ConfigurationKeyComparer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ namespace Microsoft.Extensions.Configuration
public class ConfigurationKeyComparer : IComparer<string>
{
private static readonly string[] _keyDelimiterArray = new[] { ConfigurationPath.KeyDelimiter };

/// <summary>
/// The default instance.
/// </summary>
Expand All @@ -23,7 +23,7 @@ public class ConfigurationKeyComparer : IComparer<string>
/// </summary>
/// <param name="x">First string.</param>
/// <param name="y">Second string.</param>
/// <returns></returns>
/// <returns>Less than 0 if x is less than y, 0 if x is equal to y and greater than 0 if x is greater than y.</returns>
public int Compare(string x, string y)
{
var xParts = x?.Split(_keyDelimiterArray, StringSplitOptions.RemoveEmptyEntries) ?? Array.Empty<string>();
Expand All @@ -50,7 +50,7 @@ public int Compare(string x, string y)
}
else if (xIsInt && yIsInt)
{
// Both are int
// Both are int
result = value1 - value2;
}
else
Expand Down
4 changes: 2 additions & 2 deletions src/Configuration/Config/src/ConfigurationProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public virtual void Set(string key, string value)
/// </summary>
public virtual void Load()
{ }

/// <summary>
/// Returns the list of keys that this provider has.
/// </summary>
Expand Down Expand Up @@ -80,7 +80,7 @@ private static string Segment(string key, int prefixLength)
/// <summary>
/// Returns a <see cref="IChangeToken"/> that can be used to listen when this provider is reloaded.
/// </summary>
/// <returns></returns>
/// <returns>The <see cref="IChangeToken"/>.</returns>
public IChangeToken GetReloadToken()
{
return _reloadToken;
Expand Down
4 changes: 3 additions & 1 deletion src/Configuration/Config/src/ConfigurationReloadToken.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,13 @@ public class ConfigurationReloadToken : IChangeToken
/// <summary>
/// Indicates if this token will proactively raise callbacks. Callbacks are still guaranteed to be invoked, eventually.
/// </summary>
/// <returns>True if the token will proactively raise callbacks.</returns>
public bool ActiveChangeCallbacks => true;

/// <summary>
/// Gets a value that indicates if a change has occurred.
/// </summary>
/// <returns>True if a change has occurred.</returns>
public bool HasChanged => _cts.IsCancellationRequested;

/// <summary>
Expand All @@ -30,7 +32,7 @@ public class ConfigurationReloadToken : IChangeToken
/// </summary>
/// <param name="callback">The callback to invoke.</param>
/// <param name="state">State to be passed into the callback.</param>
/// <returns></returns>
/// <returns>The <see cref="CancellationToken"/> registration.</returns>
public IDisposable RegisterChangeCallback(Action<object> callback, object state) => _cts.Token.Register(callback, state);

/// <summary>
Expand Down
Loading

0 comments on commit 551e7c2

Please sign in to comment.