2nd Level Cache and CRUD

4 posts, 0 answers
  1. Eric
    Eric avatar
    4 posts
    Member since:
    Jan 2012

    Posted 20 Mar 2012 Link to this post

    Good morning from California!

    I have a question. I'd really like to take advantage of the 2nd level cache, but, when I update/add/delete a record in the database (using LINQ via Open Access), my RadGrid doesn't get refreshed. So, I've tried using Refresh... etc... but this doesn't seem to do it.  I'm just not getting things correct. Some of the examples for this Refresh appear to be out of date with the current library. For example, some examples I've seen referenced use the scope.Refresh() function. That now seems to take arguments. Can someone point me to an example of using the 2nd level cache and CRUD while refreshing the cache for the updated project using the latest Telerik library?

    Thanks!

    -Eric

  2. Ady
    Admin
    Ady avatar
    589 posts

    Posted 22 Mar 2012 Link to this post

    Hello Eric,

     The moment you modify any object and call 'context.SaveChanges()' the object is removed from the 2nd Level Cache. The next time you access the object or call 'Refresh' on the object the values are obtained from the database.
    This link provides details on how to enable the 2nd Level Cache. All you need to get the cache to work is enable it and the caching and eviction is taken care of by OpenAccess.
    Can you send me your application or a sample application that demonstrates your use case? Maybe something is not correctly set up.

    All the best,
    Ady
    the Telerik team
    Telerik OpenAccess ORM Q1 2012 release is here! Check out what's new or download a free trial >>
  3. DevCraft banner
  4. Eric
    Eric avatar
    4 posts
    Member since:
    Jan 2012

    Posted 22 Mar 2012 Link to this post

    Hello Ady,

    Thanks for the information. I can send the code in question to you, no problem. A couple follow-up questions if I may...

    I noticed that on the RadGrid control, there is a DataBind and a Rebind method.  Could it be that the RadGrid is also utilizing some kind of cache? In other words, the 2nd level is being refreshed... but the RadGrid isn't pulling a fresh copy of the data into it?

    Should I use Rebind instead of Bind?

    Thanks!

    -Eric

  5. Ady
    Admin
    Ady avatar
    589 posts

    Posted 28 Mar 2012 Link to this post

    Hello Eric,

     If the RadGrid is configured correctly then this should not happen. I would be in a better position to provide a solution if I have a sample that can reproduce this problem. Is it possible for you to send me a sample project or the code that you use in the application?  I am particularly interested in seeing how you have setup the 2nd Level Cache and the RadGrid configuration.

    Looking forward to your reply.

    Greetings,
    Ady
    the Telerik team
    Telerik OpenAccess ORM Q1 2012 release is here! Check out what's new or download a free trial >>
Back to Top