| | 1 | | // Copyright (c) ZeroC, Inc. |
| | 2 | |
|
| | 3 | | namespace IceRpc.Locator; |
| | 4 | |
|
| | 5 | | /// <summary>A property bag used to configure a <see cref="LocatorLocationResolver" />.</summary> |
| | 6 | | public sealed record class LocatorOptions |
| | 7 | | { |
| | 8 | | /// <summary>Gets or sets a value indicating whether or not the locator must enable background lookups.</summary> |
| | 9 | | /// <value>When <see langword="true" />, if the lookup finds a stale cache entry, it returns the stale entry's |
| | 10 | | /// server address(es) and executes a call "in the background" to refresh this entry. Defaults to <see |
| | 11 | | /// langword="false" />, meaning the lookup does not return stale values.</value> |
| 1 | 12 | | public bool Background { get; set; } |
| | 13 | |
|
| | 14 | | /// <summary>Gets or sets the maximum size of the cache.</summary> |
| | 15 | | /// <value>The maximum size of the cache. <c>0</c> means no cache. Defaults to <c>100</c>.</value> |
| 8 | 16 | | public int MaxCacheSize { get; set; } = 100; |
| | 17 | |
|
| | 18 | | /// <summary>Gets or sets the refresh threshold. When the age of a cache entry is less than or equal to this |
| | 19 | | /// value, it's considered up to date and won't be updated even when the caller requests a refresh.</summary> |
| | 20 | | /// <value>The refresh threshold. Defaults to <c>1</c> second.</value> |
| 8 | 21 | | public TimeSpan RefreshThreshold { get; set; } = TimeSpan.FromSeconds(1); |
| | 22 | |
|
| | 23 | | /// <summary>Gets or sets the time-to-live. This is the time period after which a cache entry is considered |
| | 24 | | /// stale.</summary> |
| | 25 | | /// <value>The time to live. Defaults to <see cref="Timeout.InfiniteTimeSpan" />, meaning the cache entries never |
| | 26 | | /// become stale. |
| | 27 | | /// </value> |
| 13 | 28 | | public TimeSpan Ttl { get; set; } = Timeout.InfiniteTimeSpan; |
| | 29 | | } |