public override void SetAndReleaseItemExclusive()

in src/DynamoDBSessionStateStore.cs [600:640]


        public override void SetAndReleaseItemExclusive(HttpContext context,
                                                         string sessionId,
                                                         SessionStateStoreData item,
                                                         object lockId,
                                                         bool newItem)
        {
            LogInfo("SetAndReleaseItemExclusive", sessionId, lockId, newItem, context);

            string serialized = serialize(item.Items as SessionStateItemCollection);
            var expiration = DateTime.Now.Add(this._timeout);

            Document newValues = new Document();
            newValues[ATTRIBUTE_SESSION_ID] = GetHashKey(sessionId);
            newValues[ATTRIBUTE_LOCKED] = false;
            newValues[ATTRIBUTE_LOCK_ID] = null;
            newValues[ATTRIBUTE_LOCK_DATE] = DateTime.Now;
            newValues[ATTRIBUTE_EXPIRES] = expiration;
            newValues[ATTRIBUTE_FLAGS] = 0;
            newValues[ATTRIBUTE_SESSION_ITEMS] = serialized;
            newValues[ATTRIBUTE_RECORD_FORMAT_VERSION] = CURRENT_RECORD_FORMAT_VERSION;
            SetTTLAttribute(newValues, expiration);

            if (newItem)
            {
                newValues[ATTRIBUTE_CREATE_DATE] = DateTime.Now;
                this._table.PutItem(newValues);
            }
            else
            {
                Document expected = new Document();
                expected[ATTRIBUTE_LOCK_ID] = lockId.ToString();

                // Not really any reason the condition should fail unless we get in some sort of weird
                // app pool reset mode.
                try
                {
                    this._table.UpdateItem(newValues, new UpdateItemOperationConfig() { Expected = expected });
                }
                catch (ConditionalCheckFailedException) { LogInfo("(SetAndReleaseItemExclusive) Conditional check failed for update.", sessionId, context); }
            }
        }