IObjectScore does not return updated values from database

2 posts, 0 answers
  1. Ganesh
    Ganesh avatar
    4 posts
    Member since:
    Oct 2012

    Posted 26 Sep 2012 Link to this post

    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?

  2. Jan Blessenohl
    Jan Blessenohl avatar
    707 posts

    Posted 27 Sep 2012 Link to this post

    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!
  3. DevCraft banner
Back to Top