Cache Custom WCF Service in SF

Posted by Community Admin on 04-Aug-2018 14:45

Cache Custom WCF Service in SF

All Replies

Posted by Community Admin on 09-Mar-2012 00:00

Is there a way to cache the results on WCF if the Uri is the same?  I've got a slow widget on my page (calls back to a slow service) and it keeps re-running every new page visited....Is it possible to cache so that WCF doesn't have to keep re-running it?

Posted by Community Admin on 13-Mar-2012 00:00

Hello Steve,

 Where exactly do you want to cache the items? If you want to do that on the client, here's a blogpost with more info on caching with javascript:
http://davidwalsh.name/cache-ajax 
Also, if the service is slow, are you sure that your data-taking code is fully optimized?

Regards,
Svetoslav Petsov
the Telerik team
Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

Posted by Community Admin on 13-Mar-2012 00:00

Yeah, she's as optimized as she can get...it has to talk to an external service (Google Docs), parse and return the results.

So I would like the caching to be serverside if WCF can do that at all?

Like if I load up my browser, and there's an ajax call to the service, that's already happeded in X timeframe with the same parameters...return the cached results instead of re-running the entire method.

Does such a thing exist?

Steve

Posted by Community Admin on 16-Mar-2012 00:00

Hi Steve,

 If you are consuming an external service, then the server of that service is responsible for its data-caching. The only thing you can do is cache the result on the client, as you are not making any calls to your own server.

Greetings,
Svetoslav Petsov
the Telerik team
Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

Posted by Community Admin on 16-Mar-2012 00:00

Yeah I guess that's kind of what I was getting at :)  So with the WCF\SF Cache...is that what "outputCache" is supposed to do for me?

"When a user sends an HTTP GET to your service that is configured for caching, ASP.NET sends back the cached response and the service method is not called"

However even though I configured i, I was always getting the method called

Posted by Community Admin on 21-Mar-2012 00:00

Hello Steve,

 The definition is correct, but this matters only if you are getting the response from YOUR server. As far as I understand you are making a call directly to the google server to consume their service and you have no control over their own cache.

Greetings,
Svetoslav Petsov
the Telerik team
Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

Posted by Community Admin on 21-Mar-2012 00:00

Hey Svetoslav,
  Yeah that's what I'm getting at, I'm calling MY .svc files inside of my sitefinity instance.  Internally those are then using the Google API to call back to google...so I know I have no control over their cache :) So why isn't this working here for me in Sitefinity with WCF?

Steve

Posted by Community Admin on 26-Mar-2012 00:00

Hello Steve,

 I see what is the case now. The output cache configuration acts only for Sitefinity services, not for custom ones, so this is why it is not working in your case. What you need to do is implement the caching yourself, like you would do in a regular ASP.NET application. Here's a link that can help you:
http://msdn.microsoft.com/en-us/library/aa478965.aspx 
Focus on this topic 

Caching API, Using the Cache Object

The caching needs to be performed in your wrapper service and it will be used to return the cached result rather than making new calls to the google service. 

Greetings,
Svetoslav Petsov
the Telerik team
Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

This thread is closed