public override SessionStateStoreData GetItemExclusive(System.Web.HttpContext context, string id, out bool locked, out TimeSpan lockAge, out object lockId, out SessionStateActions actions) { SessionStateStoreData objItem = null; MemcachedHolder objHolder = this._client.Get <MemcachedHolder>(id); DateTime dSetTime = DateTime.Now; #region Initialized lockAge = TimeSpan.Zero; lockId = null; locked = false; actions = 0; #endregion if (objHolder != null) { if (objHolder.Locked == false) { #region objHolder.LockId++; objHolder.SetTime = dSetTime; // Locking Item for memcached objHolder.Locked = true; this._client.Store(StoreMode.Set, id, objHolder, new TimeSpan(0, 0, 0, 0, _objConfig.Timeout.Milliseconds)); actions = (SessionStateActions)objHolder.ActionFlag; lockId = objHolder.LockId; lockAge = objHolder.LockAge; if (this._bIsDbNone == false) // Saving to Db { using (IDbOperations objDb = DbFactory.CreateDbOperations(_strDbType, _strConn)) { locked = objDb.LockItemWithoutLockId(id, ApplicationName); objDb.LockItem(id, ApplicationName, objHolder.LockId); } } if (actions == SessionStateActions.InitializeItem) { objItem = Common.CreateNewStoreData(context, _objConfig.Timeout.Minutes); } else { objItem = Common.Deserialize(context, objHolder.Content, _objConfig.Timeout.Minutes); } return(objItem); #endregion } else { lockAge = objHolder.LockAge; locked = true; lockId = objHolder.LockId; actions = (SessionStateActions)objHolder.ActionFlag; return(objItem); } } else { if (this._bIsDbNone == false) // Saving to Db { using (IDbOperations objDb = DbFactory.CreateDbOperations(_strDbType, _strConn)) { return(objDb.GetItem(id, ApplicationName, _objConfig.Timeout.Minutes, context, true, out locked, out lockAge, out lockId, out actions)); } } else { return(objItem); } } }