Reece
Nintex Newbie

How to Manually Clear K2 Cache - C#

I have a custom control that executes a SmartObject List method to return some values. For some reason it is caching the values returned by the list method which means when I make a change so that new data should be returned, I am not seeing these changes - I only see the previously cached values. 

 

Is there any way I can clear the K2 cache before I execute my list method or even set the control to not use the cache?

 

Here is how I am executing my list method: 

 

SmartObject smartObject = serverName.GetSmartObject("MySmartObject");
smartObject.MethodToExecute = "List";
smartObject.GetMethod("List").InputProperties["deleted"].Value = "no";

Thanks,

0 Kudos
Reply
4 Replies
CHIRU
Nintex Newbie

Re: How to Manually Clear K2 Cache - C#

Hi Reece ,

 

Yes , you can manually remove the K2 cache.Please find steps below

 

1) Open the Force Identity service Refresh.

2) double click and runs the exe.

3) New Dialog box is opened , mentioned the web server name against the K2ServerName and click on Ok button.

 

 

Hope it will works for you !!!

 

Regards

Ruchi

Reply
B5A7
Canvas Initiate

Re: How to Manually Clear K2 Cache - C#

I was intrigued that a user cache refresh would fix this issue, unless of course caching is done on a per-user basis.  Dcoumented my solution for a form at https://stackoverflow.com/questions/61073119/stop-k2-returning-cached-smart-object-results/*personal....

0 Kudos
Reply
Mikhail2
Nintex Newbie

Re: How to Manually Clear K2 Cache - C#

I would venture to say that maybe you populate your custom control with data upon form initialize (check/show form rules here) and in this case this is why you need to refresh form to see changed data. Data population in control depends on control configuration/form rules. Some control populated on form initialize steps and do caching for improved performance - normally you will see relevant rules and settings in control properties. I suggest you to investigate into this direction.

0 Kudos
Reply
B5A7
Canvas Initiate

Re: How to Manually Clear K2 Cache - C#

Thanks Mikhail.  I am not using a custom control.  This issue is encountered when using out of the box K2 form handling to call a smart object method that returns data from SQL Server.  I have discovered this morning that after performing a restart of the K2 service and doing an iisreset, the problem reoccurs.  I tested each of these in isolation to see if only one is resetting the form content (and not loading the new content!) but I could replicate the same behavior using either.

 

I have since discovered that I if I select a record that contains the value , the value is displayed but as soon as I choose a record that does not contain the value, then the record that has the value will no longer display that record, despite the fact that the values of the record with the value have all been reloaded.

 

I also tried /designer/Caching/CacheControl.ashx?m=CLEAR at various points which did not resolve the issue so, I will have a closer look at the rule for displaying the value.  It must be failing despite the reload of the data.

0 Kudos
Reply