Developer forum

Forum » Integration » Variants not visible after import until app service is restarted

Variants not visible after import until app service is restarted

Espen Strømsnes
Espen Strømsnes
Reply

We're importing variants using the Dynamicwebprovider into the tables EcomProducts, EcomVariantGroupProductRelation, EcomVariantOptionsProductRelation and some other tables.

The interesting issue is that when a new product is imported (with 1 variant), the product isn't rendered correct in front-end or in backend until I do a restart of the Azure App Service.

When browsing the product in Admin, there's no arrow indicating variants on the product until the app service is restarted.  After a restart of the app service the variant is visible both in front-end and back-end (with no other changes made).

This leads me to think there's a caching issue involved. How do I reset the variant-cache after products have been imported?

Site is hosted in Azure, DW version is 9.4.17.

Regards,

Espen


Replies

 
Anders Ebdrup
Anders Ebdrup
Reply

Hi Esben,

 

We see the same issues, so it will be great to have this fixed.

 

Best regards, Andesr

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

We had a product cache issue which was fixed in the 9.5.2 release.
Do you experience these cache issues on 9.5.2 or later?

Best regards,
Morten

Votes for this answer: 1
 
Espen Strømsnes
Espen Strømsnes
Reply

Thanks for the quick reply Morten.

I will try to do an upgrade to a new 9.5.x version of DW to see if that resolves the issue.

But, can you please answer how this is fixed, i.e. when is this cache reset? Does it happen at fixet intervals, does it happen after an import job is finished, after changes to variant tables are detected, etc, etc?

 

Regards

Espen

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

The cache is cleared after an import job is finished.

/Morten

Votes for this answer: 1
 
Espen Strømsnes
Espen Strømsnes
Reply

Thanks for the explanation Morten.

Regards

Espen

 
Espen Strømsnes
Espen Strømsnes
Reply

How can I clear the product cache programatically?

The reason I'm asking is that I have a notification subscriber that does some extra manipulation of related products after an integration job has finished. Because of this I need to be sure the cache is cleared after my maniuplation is done. 

 

Espen

 
Dmitriy Benyuk Dynamicweb Employee
Dmitriy Benyuk
Reply

Hi Espen,
from the Dynamicweb.Ecommerce package you can call the next methods:
Dynamicweb.Ecommerce.Common.Application
KillVariantGroups()
KillVariantOptions()
KillGroups()
KillProducts()
KillProductCategories()
or KillAll() - that will clear all application variables.
Regards, Dmitrij

 
Espen Strømsnes
Espen Strømsnes
Reply

Thanks for the quick reply Dmitrij.

Would it then be sufficient to call KillProducts to clear the related products cache?

Regards,

Espen

 
Dmitriy Benyuk Dynamicweb Employee
Dmitriy Benyuk
Reply
This post has been marked as an answer

Hi Espen,
yes, as there is no other method with regards to related products.
Regards, Dmitrij

Votes for this answer: 1
 
Maik Van Sark
Reply

Hi, so im missing the KillProductCategoryFields here. Is there any other way to reset/refresh the cache from the db table EcomProductCategoryFieldValue? If have tried the KillAll but this didnt help. Also Cache.Current.Remove("Ecom:ProductCategoryFieldValues"); doenst work. Any other suggestions cause now we always see cached product information after an import. The database does show the correct product information after the import.

 
Morten Bengtson Dynamicweb Employee
Morten Bengtson
Reply

Hi Maik,

The category field values will be cleared from cache by calling either KillAll() or KillProductCategories();

If KillAll doesn't help then you are probably using an older version. Upgrade to 9.6 and it should work.

Best regards,
Morten

 
Brian Bolks
Reply

Hi Morten, 

We are using 9.6.3.

I see KillProductCategories() clears 

Services.ProductCategories.ClearCategoryCache();
Services.ProductCategories.ClearFieldCache();

But shouldnt it also call the following

 Services.ProductCategoryFieldService.ClearProductCategoryFieldCache()

 Services.ProductCategoryFieldService.ClearGroupCategoryFieldCache()

 
Hans Leeuw
Hans Leeuw
Reply

Hi Morten,

The site is already running on version 9.6.3 for a while and we still have this issue.

KInd Regards,

Hans

 
Morten Bengtson Dynamicweb Employee
Morten Bengtson
Reply

You are absolutely right. I have registered this as a bug and it will be fixed ASAP.
TFS 62833

Sorry about the inconvenience.

Best regards,
Morten

 
Brian Bolks
Reply

I see 62833 on the buglist is planned for 9.7? And 9.7 is planned for August?

 
Kristian Kirkholt Dynamicweb Employee
Kristian Kirkholt
Reply

Hi 

The problem regarding #62833 "Product category field value related caches are not cleared after data integration import" has now been resolved in Dynamicweb version 9.6.6 and also later 9.7

Download from here: http://doc.dynamicweb.com/releases-and-downloads/releases

Let me know if you need any more help regarding this

Kind Regards
Dynamicweb Support
Kristian Kirkholt

 
Claus Ørum-Petersen
Reply

Hi,

This is still an issue in 9.6.6 at least with variants in the ecom admin backend - calling Application.KillVariantGroups() and Application.KillVariantOptions() only changes the cache for the frontend it seems.

Regards Claus

 
Espen Strømsnes
Espen Strømsnes
Reply

Hi again.

This is still an issue in 9.6.13. The newly imported variants are still not visible after import. They appear when the Azure instance is restarted. I even have a custom notificationsubscriber that invokes Application.KillAll() after the integration job has finished.

What do I need to do to ensure newly variants are visible after import?

Regards,

Espen

 
Dmitriy Benyuk Dynamicweb Employee
Dmitriy Benyuk
Reply
This post has been marked as an answer

Hi Espen,
Could you try to call the: Dynamicweb.Ecommerce.Variants.VariantService ClearCache() method?
This should clear all cache related to Variants.
Best regards, Dmitrij

Votes for this answer: 1
 
Espen Strømsnes
Espen Strømsnes
Reply

Thanks for the quick reply Dmitriy.

Just to be sure; is this the correct way of getting an instance of the VariantService and clearing the cache?:

var variantService = Dynamicweb.Ecommerce.Services.Variants;

variantService.ClearCache();

 

Regards,

Espen

 
Dmitriy Benyuk Dynamicweb Employee
Dmitriy Benyuk
Reply

Hi Espen,
yes
Best regards, Dmitrij

 
Anders Ebdrup
Anders Ebdrup
Reply

Dear Dynamicweb,

 

When is the variant cache fixed as we also see this issue in 9.6.11?

 
Martin Vang
Martin Vang
Reply

Hi Anders,

Sorry about this, but I don't know what went wrong with this fix - it's now fixed such that KillAll will correctly call the clear cache method for variants.

Bug 71084: Variant cache not cleared on KillAll

Will probably be part of next hotfix for 9.7

BR

Martin

 
Kristian Kirkholt Dynamicweb Employee
Kristian Kirkholt
Reply

Hi Anders

Bug #71084 Variant cache not cleared has been resolved in Dynamicweb hotfix version 9.7.3

To upgrade please choose this version from download:

http://doc.dynamicweb.com/releases-and-downloads/releases

Let me know if you need any more help regarding this

Kind Regards
Dynamicweb Support
Kristian Kirkholt

 

You must be logged in to post in the forum