Skip to content
This repository was archived by the owner on Apr 27, 2019. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion Consul/Client.cs
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,8 @@ public class QueryOptions
Consistency = ConsistencyMode.Default,
Datacenter = string.Empty,
Token = string.Empty,
WaitIndex = 0
WaitIndex = 0,
Cached = false
};

/// <summary>
Expand Down Expand Up @@ -353,6 +354,13 @@ public class QueryOptions
/// for the sort.
/// </summary>
public string Near { get; set; }

/// <summary>
/// This query flag will tell the consul agent to return a cached resource, if the endpoint supports caching.
/// Some read endpoints support agent caching. They are clearly marked in the documentation. Agent caching can take two forms, simple or background refresh depending on the endpoint's semantics.
/// https://www.consul.io/api/index.html
/// </summary>
public bool Cached { get; set; }
}

/// <summary>
Expand Down Expand Up @@ -1045,6 +1053,10 @@ protected override void ApplyOptions(ConsulClientConfiguration clientConfig)
{
Params["near"] = Options.Near;
}
if (Options.Cached)
{
Params["cached"] = string.Empty;
}
}

protected void ParseQueryHeaders(HttpResponseMessage res, QueryResult<TOut> meta)
Expand Down