src/client/client.go
func (c *cachedLoader) Initialize() error {
	pairs, _, err := c.consulKV.List(c.namespace, nil)
	if err != nil {
		return fmt.Errorf("Could not pull config from consul: %v", err)
	}

	//write lock the cache incase init is called more than once
	c.cacheLock.Lock()
	defer c.cacheLock.Unlock()

	c.cache = make(map[string][]byte)
	for _, kv := range pairs {
		c.cache[kv.Key] = kv.Value
	}
	return nil
}
func (c *cachedLoader) Initialize() error {
	pairs, _, err := c.consulKV.List(c.namespace, nil)
	if err != nil {
		return fmt.Errorf("Could not pull config from consul: %v", err)
	}

	//write lock the cache incase init is called more than once
	c.cacheLock.Lock()
	defer c.cacheLock.Unlock()

	c.cache = make(map[string][]byte)
	for _, kv := range pairs {
		c.cache[kv.Key] = kv.Value
	}
	return nil
}
func ( c * cachedLoader ) Initialize ( ) error { pairs , _ , err := c . consulKV . List ( c . namespace , nil ) if err != nil { return fmt . Errorf ( " " , err ) } //write lock the cache incase init is called more than once c . cacheLock . Lock ( ) defer c . cacheLock . Unlock ( ) c . cache = make ( map [ string ] [ ] byte ) for _ , kv := range pairs { c . cache [ kv . Key ] = kv . Value } return nil }
// Initialize loads the consul KV's from the namespace into cache for later retrieval
Initialize loads the consul KV s from the namespace into cache for later retrieval