예제 #1
0
파일: Redis.cs 프로젝트: radtek/Shop
        public static void RemoveLoginUserSession(int userId)
        {
            if (userId <= 0)
            {
                return;
            }

            string redis_key = "SESS_*_LoginUser_UserID:" + userId.ToString();

            using (RedisNativeClient RNC = GetNativeClientForKeySpace(space))
            {
                var temp = RNC.Keys(redis_key);

                if (temp != null && temp.Length > 0)
                {
                    for (int i = 0; i < temp.Length; i++)
                    {
                        var tempKey = Encoding.UTF8.GetString(temp[i], 0, temp[i].Length);

                        if (tempKey != null)
                        {
                            RNC.Del(tempKey.ToString());
                        }
                    }
                }
            }
        }