protected void Page_Load(object sender, EventArgs e) { // Initialize cache client string cacheHost = ConfigurationManager.AppSettings["cacheHost"]; int cachePort = int.Parse(ConfigurationManager.AppSettings["cachePort"]); CacheLib.Client client = new CacheLib.Client(cachePort, cacheHost); client.Get("test"); TrainingWCFService.WCFInvoker invoker = new TrainingWCFService.WCFInvoker(ConfigurationManager.AppSettings["WCFServiceAddress"]); invoker.HealthCheck(); }
protected void Button1_Click(object sender, EventArgs e) { if (TextBoxSearch.Text != null && TextBoxSearch.Text.Length > 0) { string s = TextBoxSearch.Text.Trim(); string[] values = s.Split(' '); if (values.Length > 0) { TrainingWCFService.WCFInvoker invoker = new TrainingWCFService.WCFInvoker(ConfigurationManager.AppSettings["WCFServiceAddress"]); invoker.LogOperation(values); string operation = invoker.GetOperation(values); // Initialize cache client string cacheHost = ConfigurationManager.AppSettings["cacheHost"]; int cachePort = int.Parse(ConfigurationManager.AppSettings["cachePort"]); CacheLib.Client client = new CacheLib.Client(cachePort, cacheHost); client.Get(operation); string result = new BusinessLogic.SearchProvider(ConfigurationManager.AppSettings["Datasource"]).GetValue(operation); if (result != null) { Response.Write(result); } else { invoker.RegisterOperation(values); result = new BusinessLogic.SearchProvider(ConfigurationManager.AppSettings["Datasource"]).GetValue(operation); Response.Write(result); client.Put(operation, result); } } } }