I have a cfc which I create a session instance of. The cfc object represents a shopping basket and I create one instance of it in application.cfm:
The object has functions to add items, delete items and update items and each of these functions contains a call to a stored procedure using cfstoredproc. After adding, deleting or updating the basket's products another function is called that clears the product list in the basket object and calls another stored proc to refill the product list from the database.
It all works very smoothly when I either add or delete items. I run the function, refresh the product list and voila, the product has been added or subtracted from the database.
THE PROBLEM:
When I run the update function however, the values in the database update instantly and yet these changed values are not changed in my Basket object, even tho I am querying the database for those values.
However (#2), when the session expires and a new session.basket object is created the edited values appear in the basket items correctly.
My theory:
The results of the cfstoredproc query are being cached by Coldfusion, and will only change if the number of items the query is producing changes.
Does this sound familiar or correct? If so, is there a way I can not have it use this behaviour?
Many thanks in advance
DT
Code:
<cfif not isDefined('session.Basket')>
<cfobject name="session.Basket" component="myApp.components.basket">
</cfif>
The object has functions to add items, delete items and update items and each of these functions contains a call to a stored procedure using cfstoredproc. After adding, deleting or updating the basket's products another function is called that clears the product list in the basket object and calls another stored proc to refill the product list from the database.
It all works very smoothly when I either add or delete items. I run the function, refresh the product list and voila, the product has been added or subtracted from the database.
THE PROBLEM:
When I run the update function however, the values in the database update instantly and yet these changed values are not changed in my Basket object, even tho I am querying the database for those values.
However (#2), when the session expires and a new session.basket object is created the edited values appear in the basket items correctly.
My theory:
The results of the cfstoredproc query are being cached by Coldfusion, and will only change if the number of items the query is producing changes.
Does this sound familiar or correct? If so, is there a way I can not have it use this behaviour?
Many thanks in advance
DT