Exemplo n.º 1
0
        //17.GetCounter 传递多个key值
        public void GetCounterMutiplekeys()
        {
            //Get several values at once
            MemcachedClient cache = MemcachedClient.GetInstance("BeITMemcached");

            cache.SetCounter("mycounter2", 365);
            ulong?[] result = cache.GetCounter(new string[] { "mycounter", "mycounter2" });
            HandleLogs("[Cmd=Gets]GetCounterMutiplekeys mycounter:" + result[0].ToString() + ",+ mycounter2:" + result[1].ToString());
        }
Exemplo n.º 2
0
        //10.GetCounter test
        public void GetCounterTest()
        {
            MemcachedClient cache = MemcachedClient.GetInstance("BeITMemcached");

            cache.SetCounter("mycounter", 1213);
            ulong?counter = cache.GetCounter("mycounter");

            if (counter.HasValue)
            {
                HandleLogs("[Cmd=GetCounter]mycounter:" + counter.Value.ToString());
            }
        }
Exemplo n.º 3
0
        //4.SetCounter test
        public String SetCounterTest()
        {
            MemcachedClient cache = MemcachedClient.GetInstance("BeITMemcached");

            cache.SetCounter("mycounter", 9000);
            ulong?counter = cache.GetCounter("mycounter");

            if (counter.HasValue)
            {
                return(HandleLogs("[Cmd=SetCounter]mycounter:" + counter.Value.ToString()));
            }
            return(null);
        }
Exemplo n.º 4
0
 /// <summary>
 /// 设置计数器
 /// </summary>
 /// <param name="key">键</param>
 /// <param name="value">值</param>
 public void SetCounter(string key, ulong value)
 {
     _mcClient.SetCounter(key, value);
 }
Exemplo n.º 5
0
 /// <summary>
 /// 设置缓存计数器
 /// </summary>
 /// <param name="strKey">键</param>
 /// <param name="ulongCount">值</param>
 /// <returns></returns>
 public static bool SetCounter(string strKey, ulong ulongCount)
 {
     return(cache.SetCounter(strKey, ulongCount));
 }