Customer Portal Caching

Jun 2, 2010 at 11:25 AM

Hi,

As per the documentation website caching is enabled for performance, however this seems to be impacting some of the functionality, for example when adding notes to a case the customer (via the portal) can't immediately see these notes, presumably becuase the server has simply issued back to the client the previous page already cached.

Does this sound like a problem we should be having?  Do others have this problem?  What is the quickest way to disable, or reduce the caching as per current build?

Thanks,

Mike.

Jun 8, 2010 at 7:35 AM

Hi Shan, any view on this?

thanks,

Mike.

Jun 8, 2010 at 2:13 PM

Page 7 of the Customer Portal Content Management Guide_V1.0.doc file outlines how you can invalidate cache.  I always have this as a toolbar icon so that I can invalidate it all the time.  I also have a workflow assembly with cache invalidation activities that can be used to invalidate the cache.  Finally, the cache can be configured, but it is not well documented.  I am planning on writing a blog article on this topic soon.  Stay tuned.

Shan McArthur
www.shanmcarthur.net

Jun 9, 2010 at 8:30 AM

Hi Shan,

Many thanks for taking the time to reply, looking forward to the blog. 

The specific issue is new notes added to a Case through CRM (after the customer portal user has viewed the case in customer portal - hence it is cached) the new notes from CRM can't be seen in the customer portal, its easily recreated.

Regards,

Mike.

Jun 10, 2010 at 2:16 PM
Edited Jun 10, 2010 at 2:38 PM

I look forward to this blog post as well.  This is an obstacle we are trying to get past

Aug 12, 2010 at 8:20 PM

I'm having problems with my client because he wants to see the changes made in the CRM immediately in the portal. My implementation is being held in the testing phase because of this inconvenience. Please can someone tell me what is the fastest way to solve this problem and that is transparent to the user (a button on the toolbar, definitely not).

 Thank you very much.

Aug 12, 2010 at 8:29 PM

The cache invalidation plugin didn't get shipped, and we are checking into seeing if we can release the source code for it.  Now that said, another approach is to add an on-save handler to your CRM forms that will call out to your portal and invalidate a specific cache item.  Take a look on the case entity, I believe there is an example there.  The javascript injects a hidden IFRAME, then sets the source to your cache invalidation url.  You will have to adjust it for your portal domain name, but it should work for your purposes.  The better long term thing is to register a cache invalidation workflow or plugin, but that needs some development.

Shan

Aug 12, 2010 at 10:09 PM
Shan:

Thank you for your attention. I like the idea of the plugin and I have experience in this type of development, but I'm not sure that I can run this code from an assembly. I will try with the iframe to see how it goes.

Thank you again.


RC.-





From: [email removed]
To: [email removed]
Date: Thu, 12 Aug 2010 13:29:14 -0700
Subject: Re: Customer Portal Caching [customerportal:214703]

From: shan_mcarthur
The cache invalidation plugin didn't get shipped, and we are checking into seeing if we can release the source code for it. Now that said, another approach is to add an on-save handler to your CRM forms that will call out to your portal and invalidate a specific cache item. Take a look on the case entity, I believe there is an example there. The javascript injects a hidden IFRAME, then sets the source to your cache invalidation url. You will have to adjust it for your portal domain name, but it should work for your purposes. The better long term thing is to register a cache invalidation workflow or plugin, but that needs some development.
Shan
Read the full discussion online.
To add a post to this discussion, reply to this email (customerportal@discussions.codeplex.com)
To start a new discussion for this project, email customerportal@discussions.codeplex.com
You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe or change your settings on codePlex.com.
Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at codeplex.com
Oct 20, 2010 at 5:21 AM
Edited Oct 20, 2010 at 5:22 AM

Hi

I need to be able to force cache refreshes for the case entity - very frustrating that the caching is not configurable! 

So, I have located the javascript in the case on load event as mentioned in the last Post by Shan

var doc = window.top.document;
var iframe = doc.createElement('iframe');
iframe.setAttribute('src', 'http://eservice.reuben.adxstudio.com/Cache.axd?Message=Create&EntityName=case');
iframe.setAttribute('style', 'display:none;visibility:hidden;height:0;width:0;');
iframe.setAttribute('height', '0');
iframe.setAttribute('width', '0');
doc.body.appendChild(iframe);

Updated the src attribute to my portal URL (funnily enough not called eService.Reuben...!).  But this still does not work, I have cleared browser cache and the javascript seems to run ok. 

However, I have had some success, by replacing

iframe.setAttribute('src', 'http://myportal.com/Cache.axd?Message=Create&EntityName=case');

with a line from at cache invalidator script from the Portal Management Document to invalidate all cache entries

iframe.setAttribute('src', 'http://myportal.com/Cache.axd?InvalidateAll&d=' + (new Date()).valueOf());

It works!  But I don't want to invalidate the entire cache everytime someone saves a case - anyone else struck this issue? Maybe there is a better approach, a possibly a scheduled job?

Regards

Adam

Nov 5, 2010 at 2:29 AM

Adam, and any other interested parties.

The following is what I've been doing do invalidate the cache (on an entity collection basis).  It was sufficient for us to invalidate all instances of selected entity types each request, so while it's still a bit of overkill, it meets our clients' needs.

Basically, it allows you to invalidate the cache for only those entity types that you select; most importantly (if you're using the portal framework) leaving the CMS entities cached for performance.

To Cache or Not to Cache

Nov 5, 2010 at 4:18 AM
shan_mcarthur wrote:

The cache invalidation plugin didn't get shipped, and we are checking into seeing if we can release the source code for it.  Now that said, another approach is to add an on-save handler to your CRM forms that will call out to your portal and invalidate a specific cache item.  Take a look on the case entity, I believe there is an example there.  The javascript injects a hidden IFRAME, then sets the source to your cache invalidation url.  You will have to adjust it for your portal domain name, but it should work for your purposes.  The better long term thing is to register a cache invalidation workflow or plugin, but that needs some development.

Shan

See here for a run down on how to get the "not quite so unshipped as originally thought" cache invalidation plugin going:

Caching Revisited – CRM 4.0 SDK – Advanced Developer Extensions

Nov 5, 2010 at 7:59 PM

Great Find Pogo, it works great. I was just looking into this today. 

Nov 9, 2010 at 11:39 PM

What is the default time for out of the box caching? Can not see where if at all this is documented is it aroudn 2 hours?

Any actuals great as Customer chasing me for it.

Thanks