This thread looks to be a little on the old side and therefore may no longer be relevant. Please see if there is a newer thread on the subject and ensure you're using the most recent build of any software if your question regards a particular product.
This thread has been locked and is no longer accepting new posts, if you have a question regarding this topic please email us at support@mindscape.co.nz
|
Hi all, I'm running in to a strange issue that I belive is due to caching. Here is what is happening. I have 2 models, a user and a spider with a 1 to 1 relationship. A user can be the "current" user on a spider. I have 2 applications, one is an IIS ASP.NET application, the other is a windows service. Both share a commong project for Lightpeed persistance and Models, as well as a service layer. 1. User connects to a spider 2. Service updates database to insert the foreign key (via LS) 3. AJAX control on the site calls service layer and gets current online users (these steps work) 4. User disconnects from the spider 5. Service updates database to set foreign key to null (works, I can query the db and see it's correct) 6. AJAX control on site calls service layer and gets current online users. This step fails, it returns the cached result from call 3. I know my code works correctly, my Unit tests validate all my queries are correct, and I can see the data in the database is correct. Is there a way via debug I can tell where these objects are being populated, either via cache or the db. If it's in the cache, how can I force LS to fetch the latest from the DB and not cache using the Query object?
Thanks, Todd
|
|
|
Ignore my spelling, I forgot to spell check! |
|
|
I assume the "service layer" called by the AJAX control is running in IIS rather than in the Windows service -- is that correct? If so the service layer just needs to instantiate a new unit of work to respond to the AJAX control's query. The exception is if you have L2 caching turned on (i.e. via LightSpeedContext.Cache), in which case the new unit of work will check the L2 cache first. In this case, you can remove the entity from the cache using LightSpeedContext.Cache.Remove. Once you've done that, the next request for the entity will hit the unit of work, and therefore -- assuming that you are using a fresh UOW -- the database. |
|
|
Hi Ivan, Thanks as always for the prompt response. I've removed caching from our configuration just to test and that resolves the issue.
Todd |
|