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

What happens when I enable caching?

7 Answers 133 Views
Getting Started
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
sitefinitysteve
Top achievements
Rank 2
Iron
Veteran
sitefinitysteve asked on 20 Feb 2010, 02:08 AM
Ok, so I enabled the cache in the options for my OA project...

So lets say I have a Label on my aspx page which on page load I open my scope, run a linq query to get my object, and set the value of the label to the DB value...and on page unload I dispose of the scope.

....so then I click a button which posts back to the server...

Would then would happen when the above query\scope runs again...new DB query or the query is cached in OA and just gives me the data again?

7 Answers, 1 is accepted

Sort by
0
IT-Als
Top achievements
Rank 1
answered on 23 Feb 2010, 08:25 AM
Hi Steve,

As per my understanding there's 1st level cache and 2nd level cache.

Let's take the first level - eh yeah - first :-) :

This cache lives and dies with the object scope. So if you dispose your scope and creates a new one for example between postbacks a new query will hit the DB. If you keep the scope alive (you do not dispose it), queries for the same object (one that is already in the object scope cache) will fetch it from the cache.

The 2nd one

This cache lives separately from the object scopes and is therefore shared by object scopes. So in your scenario (where you create-dispose with each thread/request) it is a perfect match..  On the second query for the same object it will go to the second level cache for the object instead of hitting the DB.   Also... the 2nd level cache can be distributed..so caches living in different appdomains can be sync'ed against each other.

All of the above is per my understanding. We use the 2nd level cache in our WCF powered solution and it boosts performance nicely.

Regards

Henrik
0
sitefinitysteve
Top achievements
Rank 2
Iron
Veteran
answered on 23 Feb 2010, 12:39 PM
Well that sounds awesome :)  I just turned on L2 for the hell of it, sounds like it's exactly what I need!
0
Damyan Bogoev
Telerik team
answered on 24 Feb 2010, 03:04 PM
Hello Steve,

Additional information about the caching mechanism of the Telerik OpenAccess ORM can be found in the following articles: “2nd Level Cache” and “Caching optimization” as well as the blog post “OpenAccess ORM Second Level Cache API”.
I hope the information will be helpful for you.

All the best,
Damyan Bogoev
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
sitefinitysteve
Top achievements
Rank 2
Iron
Veteran
answered on 26 Feb 2010, 05:45 PM
This doesn't actually seem to be working...a SQL profile on the DB still shows a simple object query hitting the DB every time

//Query
Auth auth = scope.Extent<Auth>().Where(x => x.AuthID == AuthID).FirstOrDefault();

//Profile result every page refresh
exec sp_execute 4,@p0='139A9919-DFA1-450C-BF6E-9DF25253A9F3',@__TAKE=1
0
Damyan Bogoev
Telerik team
answered on 03 Mar 2010, 07:23 PM
Hello Steve,

You could review the caching example from our code library: Caching – C#.NET and Caching – VB.NET as well as the example from our demo site.
You could find them useful for correct settings of the caching mechanism in your application.
I hope the provided information will be helpful for you.

Sincerely yours,
Damyan Bogoev
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
gfkrt
Top achievements
Rank 2
answered on 21 Jul 2011, 09:50 AM
Hello Henrik,

could you please describe how you use the l2 cache in your wcf application?

I also turned the cache on in our wcf application, but I see no differences in performance.

Thanks & kind regards,
Peter
0
IT-Als
Top achievements
Rank 1
answered on 01 Aug 2011, 07:40 AM
Hello gfkrt,

Sorry for the late response... Vacation. :-)

You should be aware that you need the L2 cache settings in your web.config if your WCF services is hosted by IIS
Tags
Getting Started
Asked by
sitefinitysteve
Top achievements
Rank 2
Iron
Veteran
Answers by
IT-Als
Top achievements
Rank 1
sitefinitysteve
Top achievements
Rank 2
Iron
Veteran
Damyan Bogoev
Telerik team
gfkrt
Top achievements
Rank 2
Share this question
or