3
votes

I need to Cache certain objects which are based on SharePoint Managed Client Object Model like ClientContext, GroupCollection, User , List etc. Initially I tried using Appfabric cache but it gives some issues like "cannot be serialized" . Here my question is "Is it possible to serialize SharePoint Managed Client Object Model based Objects?" .

Next I tried with .NET ObjectCache which actually caches the SP's Managed Client Objects but problem over here is I need a distributed / unified caching technique. As per my knowledge we cant make ObjectCache distributed over multiple hosting servers. Can anyone suggest me a solution or show me light to proceed. Thanks in advance.

2

2 Answers

2
votes

SharePoint Client Object Model will not support Object Cache w.r.t the Client objects. That is the limitation in Client Object Model.

0
votes

You cannot serialize the context or the result of a query. Also a ListItem cannot be serialized. Nonetheless: At least when thinking about query-results the most important information you usually want to know is the content of the fields returned. So, ListItem.FieldValues is a simple Dictionary<string,object> which can be easily serialized.

You could use this Dictionary in combination with the Listitem's ID to create your own caching mechanism.