Beispiel #1
0
 public string GetConfig(string path, bool local = true)
 {
     if (local)
     {
         return(ZkCache.GetValue(path));
     }
     else
     {
         return(Watch(path));
     }
 }
Beispiel #2
0
        public string Watch(string path)
        {
            var stat = Zookeeper.Exists(path, new ConfigCenterWatcher(Zookeeper, ZkCache));

            if (stat != null)
            {
                var data = Zookeeper.GetData(path, false, null).GetString();
                ZkCache.SetValue(path, data);
                return(data);
            }

            return(null);
        }