public T Execute <T>(string name, Func <T> func)
        {
            WaitforRedial.WaitforRedialFinish();
            string id = GetPath(name);

            try
            {
                Zk.Create(id, null, Ids.OPEN_ACL_UNSAFE, CreateMode.Ephemeral);
                return(func());
            }
            finally
            {
                Zk.Delete(id, -1);
            }
        }
Esempio n. 2
0
        public T Execute <T>(string name, Func <T> func)
        {
            WaitforRedial.WaitforRedialFinish();
            string setKey   = GetSetKey();
            string fieldKey = GetFieldKey(name);

            try
            {
                _redisRedialManager.Db.HashSet(setKey, fieldKey, DateTime.Now.ToString("yyyy-MM-dd HH:mm"));
                return(func());
            }
            finally
            {
                _redisRedialManager.Db.HashDelete(setKey, fieldKey);
            }
        }
        public void Execute(string name, Action <object> action, object obj)
        {
            WaitforRedial.WaitforRedialFinish();

            string id = GetPath(name);

            try
            {
                Zk.Create(id, null, Ids.OPEN_ACL_UNSAFE, CreateMode.Ephemeral);
                action(obj);
            }
            finally
            {
                Zk.Delete(id, -1);
            }
        }
Esempio n. 4
0
        public void Execute(string name, Action <object> action, object obj)
        {
            WaitforRedial.WaitforRedialFinish();
            string setKey   = GetSetKey();
            string fieldKey = GetFieldKey(name);

            try
            {
                _redisRedialManager.Db.HashSet(setKey, fieldKey, DateTime.Now.ToString("yyyy-MM-dd HH:mm"));
                action(obj);
            }
            finally
            {
                _redisRedialManager.Db.HashDelete(setKey, fieldKey);
            }
        }