Is there a way to refresh session variables mid-script? And should it be necessary to do so anyway?
We’re writing a script to handle the situation where a payment page is submitted more than once. The simplified script below shows how we use a transaction to manage locking the session. We have multiple nodes, use a datasource for session data and include this.sessioncluster=true in our Application.cfc.
If you run the script in a few browser windows, each returns “1”. I expected that only the first call would return “1” and subsequent pages called while the first transaction was processing would return an error.
<cfset session.display=1>
<cftransaction action="begin" isolation="serializable">
<cfquery name="sessionlock" datasource="customer">
select customer from customer where customer='1' for update
</cfquery>
<cfoutput>#session.display#</cfoutput>
<cfset structdelete(session,"display")>
<cfset sleep(5000)>
</cftransaction>
Is this a bug or am I mistaken? If I am mistaken, is there a way to refresh the session data after the start of the transaction?
Simon