How to cache data in a SharePoint web part

Here is some sample code to cache a list of strings in a web part.

List<String> documentNames = new List<String>();
 object cacheddocumentNames = PartCacheRead(Storage.Shared, "DocumentNamesList");
 if (cacheddocumentNames != null)
 {
       // cache exists, use it  
        documentNames = (List<String>)cacheddocumentNames as List<String>;
 }
Advertisements

6 thoughts on “How to cache data in a SharePoint web part

  1. Hey just wanted to give you a quick heads up.
    The text in your content seem to be running off the
    screen in Firefox. I’m not sure if this is a formatting issue or something to do with web browser compatibility but I figured I’d
    post to let you know. The design look great though!
    Hope you get the problem resolved soon. Thanks

  2. Back in the past days (meaning: 10 years ago) printservers would often have
    their own collection of data that would be appended to every printjob, basically increasing the intricacy of the job.
    That was sometimes enough to make a tool run out of memory.
    I have no idea if it still makes much of a distinction
    nowadays.

Got something to add?

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s