integrate request builder into HTTP client for googleapis support (#157)
This commit is contained in:
21
builder/path_template_cache.go
Normal file
21
builder/path_template_cache.go
Normal file
@@ -0,0 +1,21 @@
|
||||
package builder
|
||||
|
||||
import "sync"
|
||||
|
||||
var (
|
||||
pathTemplateCache = make(map[string]*pathTemplate)
|
||||
pathTemplateCacheMu sync.RWMutex
|
||||
)
|
||||
|
||||
func getCachedPathTemplate(path string) (*pathTemplate, bool) {
|
||||
pathTemplateCacheMu.RLock()
|
||||
defer pathTemplateCacheMu.RUnlock()
|
||||
tmpl, ok := pathTemplateCache[path]
|
||||
return tmpl, ok
|
||||
}
|
||||
|
||||
func setPathTemplateCache(path string, tmpl *pathTemplate) {
|
||||
pathTemplateCacheMu.Lock()
|
||||
defer pathTemplateCacheMu.Unlock()
|
||||
pathTemplateCache[path] = tmpl
|
||||
}
|
Reference in New Issue
Block a user