Developer forum

Forum » Development » product cache doesn't update immediately

product cache doesn't update immediately

Arker Soe
Arker Soe
Reply

Hi,

I am trying to update product information through a schedular. But it does not update the product in the website's product catalog immediately after the schedular run. it took at least 15 min to see the change in front end. in DW backend sql firehose, I can see the product data changed in DB. Is there anyway to make it update in front end immediately?

what I did in schedular is like this.

- update the product.

- call the ProductService.ClearProductsCache();

 

 

 


Replies

 
Nicolai Pedersen
Reply

Hi Arker

You should call Dynamicweb.Ecommerce.Services.Products.ClearCache().

BR Nicolai

 
Arker Soe
Arker Soe
Reply

What I did is the same as what you say here I think.

here is the code fragment.

Dynamicweb.Ecommerce.Products.ProductService productServicevariable = new Dynamicweb.Ecommerce.Products.ProductService();
productServicevariable.ClearProductsCache();

and I cannot call it as you state above. the syntax error says the "productservice" doesn't have definition for "ClearCache".

Regards

 
Nicolai Pedersen
Reply

So what version are you using?

And do not create a new intstance of product service. Always go through Dynamicweb.Ecommerce.Services

 
Arker Soe
Arker Soe
Reply

The version is 9.6.9

and yes I have now tried calling the function without creating a new instance.

Dynamicweb.Ecommerce.Services.Products.ClearProductsCache();

The result is still the same.

 
Arker Soe
Arker Soe
Reply

Hello,

any suggestion for the issue that I mentioned above yet?

 
Nicolai Pedersen
Reply

Nope, I am sure something is wrong in your approach. The above suggestions is what we do our selves when ressetting the cache.

Maybe your scheduler runs in another appdomain? Does it run in another IIS instance?

 
Arker Soe
Arker Soe
Reply

Hello,

I am still facing the issue. I want to know if that works on 9.6.9. And if my approach is wrong, would you pls guide me on how to approach? the schedular is running from DW backend's integration's shedule jobs and I am sure it is not running on another IIS instance.

 my approach:  In scheduler, update products via sql query then call Dynamicweb.Ecommerce.Services.Products.ClearProductsCache()

 

 

 
Morten Bengtson Dynamicweb Employee
Morten Bengtson
Reply
This post has been marked as an answer

Hi Arker,

The version you are currently using is about three years old and the cache handling is very different compared to more recent versions.
I strongly recommend that you upgrade to a later version, but until then you should be able to clear the product cache by calling both KillProducts AND ClearProductsCache.

Dynamicweb.Ecommerce.Common.Application.KillProducts();
Dynamicweb.Ecommerce.Services.Products.ClearProductsCache();

Best regards,
Morten

Votes for this answer: 1
 
Arker Soe
Arker Soe
Reply

Hi Morten,

Thank you very much for replying. My issue was resolved by KillProducts() before calling the clearproductcache().

Regards

Arker Soe

 

You must be logged in to post in the forum