I am working on a SharePoint 2013 Autohosted App that retrieves a lot of information from a remote system before displaying it to the user in the App. I'd like to create a caching layer to boost the performance of the App so that it is not repeatedly making requests for the same information.

I do have a database with the App, so I could always cache items in the database (faster than continually making requests, but not necessarily ideal).

What other caching options might work in an Autohosted SharePoint App that I could consider?

  • This is one of the drawbacks of the Autohosted model. You only get a web role and a database, so if you want to cache, it is on you. There are different (perhaps better) cache strategies available if you choose provider hosted. Of course, that means you have to pay for it. But if the free offering doesn't meet your needs... – Paul Schaeflein Feb 26 '14 at 20:57
  • Yea, we may go the provider-hosted route if this doesn't pan out. :-/ – John Chapman Feb 26 '14 at 21:02

Can you deliver the data in chunks? Such as an infinite scroll or paging? If that's the case, I'd say just use AJAX and oData to grab more data as it's needed.

Also, how static is the content? Does it change often? If not you could always try browser caching or offline storage.

Simply put, we might need more information before we could better help out :-)

  • Basically when the backend (C#) code requests the data from the remote source, I'd like to cache it at this stage. So, that the next time the backend code runs, it grabs the cached version, if available, before requesting the remote data again. – John Chapman Feb 26 '14 at 20:39
  • I may try something like this: johnnycoder.com/blog/2008/12/10/c-cache-helper-class. Was hoping to find a way to use AppFabric, etc., in an AutoHosted App. – John Chapman Feb 26 '14 at 20:40
  • You know what? Why can't you cache it at the source level? If I'm not mistaken, that's how ASP sites would work as well. They cache the pages and when they run the request see if a new version is available. If not, bring in the cached version. So either way a request would be made to check if the content is new, so why cache it on receiving end? – EHorodyski Feb 28 '14 at 14:19

Here is my interim solution: using HttpContext.Current.Cache.

There is a good helper class here: http://johnnycoder.com/blog/2008/12/10/c-cache-helper-class/.

If I don't get a better solution for this, I'll mark this as the answer.

  • I think that's a decent solution. I work with SP on-prem, so that would most likely be the way we would do it but I wasn't aware if it was usable with Office 365/AppFabric. Essentially you're caching on the server level, which is what I think you want. My hesitation to this solution is that it's ASP specific so if you wanted to at one point expand the app beyond using IIS you'd need a new solution. – EHorodyski Feb 27 '14 at 13:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.