protected void ButtomBenchmark_Click(object sender, EventArgs e) { // Create new stopwatch Stopwatch stopwatch = new Stopwatch(); // Begin timing stopwatch.Start(); Parallel.For(0, 100000, x => { CookieUsers cuser = new CookieUsers(Global.ClientPool.ClientList[Global.StatsBucket], "COOKIE_PERO" + x.ToString()); cuser.CookieName = "NOVO_IME"; cuser.CookieValue = "2222"; cuser.NumUsers = x; cuser.Add(); cuser.InSync = false; cuser.Refresh(); cuser.CookieName = "ime " + x.ToString(); cuser.Set(); }); // Stop timing stopwatch.Stop(); LabelTime.Text = stopwatch.ElapsedMilliseconds.ToString() + " ms"; }
protected void ButtonLoad_Click(object sender, EventArgs e) { CookieUsers cuser = new CookieUsers(Global.ClientPool.ClientList[Global.StatsBucket], "COOKIE_PERO", true); LabelValue.Text = "COOKIE NAME: " + cuser.CookieName; cuser.CookieName = "NOVO_IME"; cuser.CookieValue = "2222"; MembaseHelper.LockAndSet(cuser, 10, new string[] { "CookieName", "CookieValue" }); }
protected void ButtonSave_Click(object sender, EventArgs e) { CookieUsers cuser = new CookieUsers(Global.ClientPool.ClientList[Global.StatsBucket]); cuser.Key = "COOKIE_PERO"; cuser.CookieName = "Pero"; cuser.CookieValue = "seljo"; cuser.NumUsers = 13; cuser.LastModification = DateTime.Now; cuser.Set(); //Global.ClientPool.Client.Store(Enyim.Caching.Memcached.StoreMode.Set, "testInt", (ulong)0); ulong val = Global.ClientPool.ClientList[Global.StatsBucket].Increment("testInt", 0, 1); this.LabelValue.Text = val.ToString(); }
protected void Page_Load(object sender, EventArgs e) { int x = new Random().Next(100); CookieUsers cuser = new CookieUsers(Global.ClientPool.ClientList[Global.PropertiesBucket], "COOKIE" + x.ToString()); cuser.CookieName = "NOVO_IME"; cuser.CookieValue = "2222"; cuser.NumUsers = x; cuser.Add(); cuser.InSync = false; cuser.Refresh(); cuser.CookieName = "ime " + x.ToString(); cuser.Set(); CookieCounter counter = new CookieCounter(Global.ClientPool.ClientList[Global.WordBucket]); counter.Key = CookieCounter.GetFullKey(x, Convert.ToByte(DateTime.Now.Day)); counter.Increment(1); counter.Refresh(); Response.Write("// " + counter.Value.ToString()); }