Ejemplo n.º 1
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));
        }
Ejemplo n.º 2
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());
            }
        }