Пример #1
0
 public void Stop()
 {
     if (Cache == null) return;
     try { if (_net != null) _net.Stop(); }
     catch { }
     _net = null;
     Cache.Dispose();
     Cache = null;
 }
Пример #2
0
 public void Start(bool console, string[] args)
 {
     //--load configuration from json file;
     var cjson = File.ReadAllText("cached.config");
     Config = new CachedConfiguration();
     Config.MergeFrom(cjson);
     
     //-- create instance of local cache and bind network listener to it.
     Cache = new LocalCache(Config);
     var uri = new Uri(Config.Address);
     switch (uri.Scheme)
     {
         case "tcp": _net = new SocketListener(); break;
         //--case "pipe": _net = new NamedPipeListener(); break;
         default: throw new ArgumentException("address:schema");
     }
     _net.Start(uri, Cache.GetServiceProtocol);
 }