//释放锁定
        public override void ReleaseItemExclusive(HttpContext context, string id, object lockId)
        {
            SessionDataObject memcachedSessionObject = _Client.Get(id) as SessionDataObject;

            if (memcachedSessionObject != null)
            {
                memcachedSessionObject.Locked = false;
                memcachedSessionObject.LockId = (Int32)lockId;
                _Client.Put(id, memcachedSessionObject, _timeout);
            }
        }
        /// <summary>
        ///将新的会话状态添加到数据区中
        /// </summary>
        /// <param name="context"></param>
        /// <param name="id"></param>
        /// <param name="timeout"></param>
        public override void CreateUninitializedItem(HttpContext context, string id, int timeout)
        {
            SessionDataObject sessionObject = new SessionDataObject
            {
                Content    = null,
                Locked     = false,
                SetTime    = DateTime.Now,
                LockId     = 0,
                ActionFlag = 1
            };

            _Client.Put(id, sessionObject, timeout);
        }
        //更新值
        public override void SetAndReleaseItemExclusive(HttpContext context, string id, SessionStateStoreData item, object lockId, bool newItem)
        {
            DateTime setTime = DateTime.Now;

            byte[]            bytes = this.Serialize((SessionStateItemCollection)item.Items);
            SessionDataObject memcachedSessionObject = new SessionDataObject()
            {
                LockId     = 0,
                Locked     = false,
                Content    = bytes,
                ActionFlag = 0,
                SetTime    = setTime
            };

            _Client.Put(id, memcachedSessionObject, item.Timeout);
        }
        public override SessionStateStoreData GetItem(HttpContext context, string id, out bool locked, out TimeSpan lockAge, out object lockId, out SessionStateActions actions)
        {
            SessionStateStoreData sessionStateStoreDate  = null;
            SessionDataObject     memcachedSessionObject = null;
            DateTime setTime = DateTime.Now;

            lockAge = TimeSpan.Zero;
            lockId  = null;
            locked  = false;
            actions = SessionStateActions.None;
            memcachedSessionObject = _Client.Get(id) as SessionDataObject;

            if (memcachedSessionObject != null)
            {
                //如果已经锁定
                if (memcachedSessionObject.Locked)
                {
                    lockAge = memcachedSessionObject.LockAge;
                    lockId  = memcachedSessionObject.LockId;
                    locked  = memcachedSessionObject.Locked;
                    actions = (SessionStateActions)memcachedSessionObject.ActionFlag;
                    return(sessionStateStoreDate);
                }

                memcachedSessionObject.LockId++;
                memcachedSessionObject.SetTime = setTime;
                _Client.Put(id, memcachedSessionObject);


                actions = (SessionStateActions)memcachedSessionObject.ActionFlag;
                lockId  = memcachedSessionObject.LockId;
                lockAge = memcachedSessionObject.LockAge;

                if (actions == SessionStateActions.InitializeItem)
                {
                    sessionStateStoreDate = this.CreateNewStoreData(context, _timeout);
                }
                else
                {
                    sessionStateStoreDate = this.Deserialize(context, memcachedSessionObject.Content, _timeout);
                }
                return(sessionStateStoreDate);
            }
            return(sessionStateStoreDate);
        }