@@ -25,6 +25,9 @@ type Limiter interface {
25
25
// Execute allow a customised wrapper around the actual execution.
26
26
// this is useful for most common circuit breaker implementation
27
27
Execute (func () error ) error
28
+ // IsCBOpen return whether CB is open
29
+ // this is useful for implementing additional logic bypass nested hystrix
30
+ IsCBOpen () bool
28
31
// ReportResult reports the result of the previously allowed operation.
29
32
// nil indicates a success, non-nil error usually indicates a failure.
30
33
ReportResult (result error )
@@ -205,32 +208,38 @@ func (opt *Options) clone() *Options {
205
208
// Scheme is required.
206
209
// There are two connection types: by tcp socket and by unix socket.
207
210
// Tcp connection:
208
- // redis://<user>:<password>@<host>:<port>/<db_number>
211
+ //
212
+ // redis://<user>:<password>@<host>:<port>/<db_number>
213
+ //
209
214
// Unix connection:
210
- // unix://<user>:<password>@</path/to/redis.sock>?db=<db_number>
215
+ //
216
+ // unix://<user>:<password>@</path/to/redis.sock>?db=<db_number>
217
+ //
211
218
// Most Option fields can be set using query parameters, with the following restrictions:
212
- // - field names are mapped using snake-case conversion: to set MaxRetries, use max_retries
213
- // - only scalar type fields are supported (bool, int, time.Duration)
214
- // - for time.Duration fields, values must be a valid input for time.ParseDuration();
215
- // additionally a plain integer as value (i.e. without unit) is intepreted as seconds
216
- // - to disable a duration field, use value less than or equal to 0; to use the default
217
- // value, leave the value blank or remove the parameter
218
- // - only the last value is interpreted if a parameter is given multiple times
219
- // - fields "network", "addr", "username" and "password" can only be set using other
220
- // URL attributes (scheme, host, userinfo, resp.), query paremeters using these
221
- // names will be treated as unknown parameters
222
- // - unknown parameter names will result in an error
219
+ // - field names are mapped using snake-case conversion: to set MaxRetries, use max_retries
220
+ // - only scalar type fields are supported (bool, int, time.Duration)
221
+ // - for time.Duration fields, values must be a valid input for time.ParseDuration();
222
+ // additionally a plain integer as value (i.e. without unit) is intepreted as seconds
223
+ // - to disable a duration field, use value less than or equal to 0; to use the default
224
+ // value, leave the value blank or remove the parameter
225
+ // - only the last value is interpreted if a parameter is given multiple times
226
+ // - fields "network", "addr", "username" and "password" can only be set using other
227
+ // URL attributes (scheme, host, userinfo, resp.), query paremeters using these
228
+ // names will be treated as unknown parameters
229
+ // - unknown parameter names will result in an error
230
+ //
223
231
// Examples:
224
- // redis://user:password@localhost:6789/3?dial_timeout=3&db=1&read_timeout=6s&max_retries=2
225
- // is equivalent to:
226
- // &Options{
227
- // Network: "tcp",
228
- // Addr: "localhost:6789",
229
- // DB: 1, // path "/3" was overridden by "&db=1"
230
- // DialTimeout: 3 * time.Second, // no time unit = seconds
231
- // ReadTimeout: 6 * time.Second,
232
- // MaxRetries: 2,
233
- // }
232
+ //
233
+ // redis://user:password@localhost:6789/3?dial_timeout=3&db=1&read_timeout=6s&max_retries=2
234
+ // is equivalent to:
235
+ // &Options{
236
+ // Network: "tcp",
237
+ // Addr: "localhost:6789",
238
+ // DB: 1, // path "/3" was overridden by "&db=1"
239
+ // DialTimeout: 3 * time.Second, // no time unit = seconds
240
+ // ReadTimeout: 6 * time.Second,
241
+ // MaxRetries: 2,
242
+ // }
234
243
func ParseURL (redisURL string ) (* Options , error ) {
235
244
u , err := url .Parse (redisURL )
236
245
if err != nil {
0 commit comments