| 
									
										
										
										
											2018-12-29 15:44:51 +00:00
										 |  |  | package registry | 
					
						
							| 
									
										
										
										
											2016-05-03 19:26:50 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | import ( | 
					
						
							| 
									
										
										
										
											2018-03-03 11:53:52 +00:00
										 |  |  | 	"context" | 
					
						
							| 
									
										
										
										
											2016-05-03 19:26:50 +01:00
										 |  |  | 	"time" | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-06-21 15:13:54 +01:00
										 |  |  | 	"github.com/micro/go-micro/client/selector" | 
					
						
							| 
									
										
										
										
											2016-05-03 19:26:50 +01:00
										 |  |  | ) | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-12-29 15:44:51 +00:00
										 |  |  | // Set the registry cache ttl | 
					
						
							| 
									
										
										
										
											2016-05-03 19:26:50 +01:00
										 |  |  | func TTL(t time.Duration) selector.Option { | 
					
						
							|  |  |  | 	return func(o *selector.Options) { | 
					
						
							|  |  |  | 		if o.Context == nil { | 
					
						
							|  |  |  | 			o.Context = context.Background() | 
					
						
							|  |  |  | 		} | 
					
						
							| 
									
										
										
										
											2018-12-29 15:44:51 +00:00
										 |  |  | 		o.Context = context.WithValue(o.Context, "selector_ttl", t) | 
					
						
							| 
									
										
										
										
											2016-05-03 19:26:50 +01:00
										 |  |  | 	} | 
					
						
							|  |  |  | } |