示例#1
0
        static void Main(string[] args)
        {
            UdpNotifierCacheDependency dependency = new UdpNotifierCacheDependency();

            ObjectCacheQueue.Instance.Add("ClientData", string.Empty, dependency);

            object oldCacheData = ObjectCacheQueue.Instance["ClientData"];

            Console.Title = "UdpCacheDependency测试Chat";

            Console.WriteLine("Please input text...");

            Thread thread = new Thread((ThreadStart)MonitorThread);

            thread.Start();

            string cmd = Console.ReadLine();

            while (cmd.ToLower() != "exit")
            {
                if (cmd.IsNotEmpty())
                {
                    if (cmd.ToLower() == "send100")
                        SendOneHundredMessages();
                    else
                        SendOneMessage(cmd);
                }

                cmd = Console.ReadLine();
            }

            thread.Abort();
            thread.Join();
        }
示例#2
0
		static void Main(string[] args)
		{
			UdpNotifierCacheDependency dependency = new UdpNotifierCacheDependency();

			ObjectCacheQueue.Instance.Add("ClientData", string.Empty, dependency);

			object oldCacheData = ObjectCacheQueue.Instance["ClientData"];

			Console.Title = "UdpCacheDependency测试服务器端";

			Console.WriteLine("Monitoring cache data...");

			while (true)
			{
				Thread.Sleep(10);

				object cacheData;

				if (ObjectCacheQueue.Instance.TryGetValue("ClientData", out cacheData))
				{
					if (cacheData != oldCacheData)
					{
						oldCacheData = cacheData;

						Console.Write("Cahce data changed to ");
						Console.ForegroundColor = ConsoleColor.Yellow;
						Console.WriteLine("'{0}'", cacheData);
						Console.ResetColor();
					}
				}
			}
		}
示例#3
0
        private void BindPage()
        {
            Response.Cache.SetNoStore();
            RenderPersonalInfo();
            RenderMenu();

            string serverTag;

            if (UserTaskChangingCache.Instance.TryGetValue(DeluxeIdentity.CurrentUser.ID, out serverTag) == false)
            {
                UdpNotifierCacheDependency dependency = new UdpNotifierCacheDependency();

                serverTag = Guid.NewGuid().ToString();
                UserTaskChangingCache.Instance.Add(DeluxeIdentity.CurrentUser.ID, serverTag, dependency);
            }

            userTaskCount.Value = PortalServices.GetUserTaskCountString(serverTag);
        }
        private static string DoUserTaskChangedQuery(string tag)
        {
            string result = string.Empty;

            string serverTag;

            if (UserTaskChangingCache.Instance.TryGetValue(DeluxeIdentity.CurrentUser.ID, out serverTag) == false)
            {
                UdpNotifierCacheDependency dependency = new UdpNotifierCacheDependency();

                serverTag = Guid.NewGuid().ToString();
                UserTaskChangingCache.Instance.Add(DeluxeIdentity.CurrentUser.ID, serverTag, dependency);
            }

            if (serverTag != tag)
                result = GetUserTaskCountString(serverTag);

            return result;
        }