Exemple #1
0
        // 레디스 테스트(int, float, string) 삭제
        private async void button4_Click(object sender, EventArgs e)
        {
            try
            {
                if (string.IsNullOrEmpty(textBoxRedisTestInt.Text) == false)
                {
                    var value = await RedisLib.DeleteString <int>(REDIS_INT_KEY);

                    DevLog.Write(string.Format("String Delete. {0} : result({1})", REDIS_INT_KEY, value));
                }

                if (string.IsNullOrEmpty(textBoxRedisTestDouble.Text) == false)
                {
                    var value = await RedisLib.DeleteString <double>(REDIS_DOUBLE_KEY);

                    DevLog.Write(string.Format("String Delete. {0} : result({1})", REDIS_DOUBLE_KEY, value));
                }

                if (string.IsNullOrEmpty(textBoxRedisTestString.Text) == false)
                {
                    var value = await RedisLib.DeleteString <string>(REDIS_STRING_KEY);

                    DevLog.Write(string.Format("String Delete. {0} : result({1})", REDIS_STRING_KEY, value));
                }

                textBoxRedisTestInt.Text = textBoxRedisTestDouble.Text = textBoxRedisTestString.Text = "";
            }
            catch (Exception ex)
            {
                DevLog.Write(ex.ToString());
            }
        }
Exemple #2
0
        // 레디스 테스트(List) 추가
        private async void button8_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(textBoxRedisTestList.Text))
            {
                DevLog.Write("Error: 빈 값입니다");
                return;
            }

            var value = await RedisLib.AddList <string>(REDIS_LIST_KEY, textBoxRedisTestList.Text);

            DevLog.Write(string.Format("List 추가. {0} : {1}. Count:{2})", REDIS_LIST_KEY, textBoxRedisTestList.Text, value));
        }
Exemple #3
0
        // 레디스 테스트(List) 삭제
        private async void button10_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(textBoxRedisTestListCount.Text))
            {
                DevLog.Write("Error: 빈 값입니다");
                return;
            }
            else
            {
                var deleteValue = textBoxRedisTestList.Text;
                int count       = textBoxRedisTestListCount.Text.ToInt32();
                var value       = await RedisLib.DeleteList <string>(REDIS_LIST_KEY, deleteValue, count);

                DevLog.Write(string.Format("List 삭제. {0} : {1})", REDIS_LIST_KEY, value));
            }
        }
Exemple #4
0
        // 레디스 테스트(List) 검색
        private async void button9_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(textBoxRedisTestListR1.Text) ||
                string.IsNullOrEmpty(textBoxRedisTestListR2.Text))
            {
                var value = await RedisLib.GetList <string>(REDIS_LIST_KEY, 0);

                DevLog.Write(string.Format("List 추가. {0} : {1})", REDIS_LIST_KEY, string.Join(",", value)));
            }
            else
            {
                int pos1  = textBoxRedisTestListR1.Text.ToInt32();
                int pos2  = textBoxRedisTestListR2.Text.ToInt32();
                var value = await RedisLib.GetList <string>(REDIS_LIST_KEY, pos1, pos2);

                DevLog.Write(string.Format("List 추가. {0} : {1})", REDIS_LIST_KEY, string.Join(",", value)));
            }
        }
Exemple #5
0
        // 레디스 테스트(PERSION) 추가
        private async void button7_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(textBoxRedisTestPName.Text) ||
                string.IsNullOrEmpty(textBoxRedisTestPAge.Text))
            {
                DevLog.Write("Error: 이름이나 나이가 빈 값입니다");
                return;
            }

            var persion = new PERSION()
            {
                Name = textBoxRedisTestPName.Text, Age = textBoxRedisTestPAge.Text.ToInt32()
            };

            await RedisLib.SetString <PERSION>(REDIS_PERSION_KEY, persion);

            DevLog.Write(string.Format("PERSION Set. {0} : {1}, {2}", REDIS_PERSION_KEY, persion.Name, persion.Age));
        }
Exemple #6
0
        // 레디스 테스트(int, float, string) 추가
        private async void button2_Click(object sender, EventArgs e)
        {
            try
            {
                if (string.IsNullOrEmpty(textBoxRedisTestInt.Text) == false)
                {
                    await RedisLib.SetString <int>(REDIS_INT_KEY, textBoxRedisTestInt.Text.ToInt32());

                    DevLog.Write(string.Format("String Set. {0} : {1}", REDIS_INT_KEY, textBoxRedisTestInt.Text));
                }

                if (string.IsNullOrEmpty(textBoxRedisTestDouble.Text) == false)
                {
                    await RedisLib.SetString <double>(REDIS_DOUBLE_KEY, textBoxRedisTestDouble.Text.ToDouble());

                    DevLog.Write(string.Format("String Set. {0} : {1}", REDIS_DOUBLE_KEY, textBoxRedisTestDouble.Text));
                }

                if (string.IsNullOrEmpty(textBoxRedisTestString.Text) == false)
                {
                    if (checkBoxAlreadyExit.Checked == false)
                    {
                        var result = await RedisLib.SetString <string>(REDIS_STRING_KEY, textBoxRedisTestString.Text);

                        DevLog.Write($"[{result}] String Set. {REDIS_STRING_KEY} : {textBoxRedisTestString.Text}");
                    }
                    else
                    {
                        var result = await RedisLib.SetStringAsyncWhenNotExists <string>(REDIS_STRING_KEY, textBoxRedisTestString.Text);

                        DevLog.Write($"[{result}] String Set. {REDIS_STRING_KEY} : {textBoxRedisTestString.Text}");
                    }
                }

                textBoxRedisTestInt.Text = textBoxRedisTestDouble.Text = textBoxRedisTestString.Text = "";
            }
            catch (Exception ex)
            {
                DevLog.Write(ex.ToString());
            }
        }
Exemple #7
0
        // 레디스 연결
        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                var result = RedisLib.Init(textBoxRedisAddress.Text);
                if (result == ERROR_ID.NONE)
                {
                    DevLog.Write("Redis 접속 성공");

                    button2.Enabled = button3.Enabled = button4.Enabled = true;
                    button7.Enabled = button6.Enabled = button5.Enabled = true;
                    button8.Enabled = button9.Enabled = button10.Enabled = button11.Enabled = button12.Enabled = true;
                }
                else
                {
                    DevLog.Write(string.Format("레디스 접속 실패. {0}", result));
                }
            }
            catch (Exception ex)
            {
                DevLog.Write(ex.ToString());
            }
        }
Exemple #8
0
        // 레디스 테스트(List) 삭제. 오른쪽에서 Pop
        private async void button12_Click(object sender, EventArgs e)
        {
            var value = await RedisLib.DeleteList <string>(REDIS_LIST_KEY, false);

            DevLog.Write(string.Format("List 오른쪽에서 Pop. {0} : {1})", REDIS_LIST_KEY, value));
        }
Exemple #9
0
        // 레디스 테스트(PERSION) 삭제
        private async void button5_Click(object sender, EventArgs e)
        {
            var value = await RedisLib.DeleteString <PERSION>(REDIS_PERSION_KEY);

            DevLog.Write(string.Format("PERSION Delete. {0} : result({1})", REDIS_PERSION_KEY, value));
        }
Exemple #10
0
        // 레디스 테스트(PERSION) 검색
        private async void button6_Click(object sender, EventArgs e)
        {
            var value = await RedisLib.GetString <PERSION>(REDIS_PERSION_KEY);

            DevLog.Write(string.Format("PERSION Get. {0} : {1}, {2}. Result:{3}", REDIS_PERSION_KEY, value.Item2.Name, value.Item2.Age, value.Item1));
        }