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

2nd Level Cache and CRUD

3 Answers 67 Views
Development (API, general questions)
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Eric
Top achievements
Rank 1
Eric asked on 20 Mar 2012, 03:53 PM

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

3 Answers, 1 is accepted

Sort by
0
Ady
Telerik team
answered on 22 Mar 2012, 04:06 PM
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 >>
0
Eric
Top achievements
Rank 1
answered on 22 Mar 2012, 09:02 PM
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

0
Ady
Telerik team
answered on 28 Mar 2012, 01:51 PM
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 >>
Tags
Development (API, general questions)
Asked by
Eric
Top achievements
Rank 1
Answers by
Ady
Telerik team
Eric
Top achievements
Rank 1
Share this question
or