diff --git a/Consul/Client.cs b/Consul/Client.cs
index 539ad84..1c23773 100644
--- a/Consul/Client.cs
+++ b/Consul/Client.cs
@@ -318,7 +318,8 @@ public class QueryOptions
Consistency = ConsistencyMode.Default,
Datacenter = string.Empty,
Token = string.Empty,
- WaitIndex = 0
+ WaitIndex = 0,
+ Cached = false
};
///
@@ -353,6 +354,13 @@ public class QueryOptions
/// for the sort.
///
public string Near { get; set; }
+
+ ///
+ /// 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
+ ///
+ public bool Cached { get; set; }
}
///
@@ -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 meta)