This is a migrated thread and some comments may be shown as answers.

IObjectScore does not return updated values from database

1 Answer 25 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Ganesh
Top achievements
Rank 1
Ganesh asked on 26 Sep 2012, 11:25 AM
Hello,
I am facing the below problem. Could you pleaes help on this?

1. I have a server application "A" which updates a database table X.
2. I also have another application "B" which polls this table X in a periodic manner.
3. Between any two such polling by "B", app "A" updates the table X. After this update, when I tries to get the data from the table, it still gives the old data and not the updated one.
4. In app "B", I resue the object of IObjectScope. Earlier I was instantiating the IObjectScope for every polling and this was working fine. (I changed this behavior because of some memory leaks issue).

It looks some internal cache within IObjectScope instance to be cleaned up before making further calls. Could you please help me on this?

Thanks,
Ganesh

1 Answer, 1 is accepted

Sort by
0
Jan Blessenohl
Telerik team
answered on 27 Sep 2012, 12:02 PM
Hi Ganesh,
We have two level of caches. The first one is the cache inside the IObjectScope instance which is invalidated whenever you start a new transaction. The second one is the second level cache that is shared by all contexts in one process. This cache is disabled by default, you should check if you did not enable it in the app.config.

The IObjectScope cache caches all objects that you have read once. If you execute a query that only asks for the primary key or a GetObjectByKey, we will return the object from the cache.

Let's look at process A. If you have two scopes there and change the object in the first, you can do a scope2.Retfresh(obj2) to get the actual values.

In the process B, you can do the same. Alternatively you can start a new transaction around your poll loop.

Kind regards,
Jan Blessenohl
the Telerik team
Follow @OpenAccessORM Twitter channel to be the first one to get the latest updates on new releases, tips and tricks and sneak peeks at our product labs!
Tags
General Discussions
Asked by
Ganesh
Top achievements
Rank 1
Answers by
Jan Blessenohl
Telerik team
Share this question
or